Aquesta és una revisió antiga del document
telegram
create bot
telgram commands
@BotFather
/newbot
- → API TOKEN
/setuserpic
@userinfobot
: nos da nuestro ID usuario telegram
info
shell script
#!/bin/bash TOKEN="escribe tu token aquí" ID="escribe tu id aquí" MENSAJE="Esto es un Mensaje de Prueba" URL="https://api.telegram.org/bot$TOKEN/sendMessage" curl -s -X POST $URL -d chat_id=$ID -d text="$MENSAJE"
#!/bin/bash function sendTelegram { local ID=$1 local MESSAGE=$2 [[ ! -z "$MESSAGE" ]] && curl -s -X POST $URL -d chat_id=$CHAT_ID -d text="$ID disponible" >> /tmp/ovh.log } TOKEN=<YOUR_TOKEN_HERE> CHAT_ID=<YOUR_CHAT_ID_HERE> MESSAGE="Hello World" URL="https://api.telegram.org/bot$TOKEN/sendMessage" JQ_PATH="/usr/local/bin/" wget -O /dev/shm/ovh.json https://ca.ovh.com/engine/api/dedicated/server/availabilities\?country=es > /dev/null jsonfiltrado=$(${JQ_PATH}jq '.[] | select(.hardware == "1801sk13") | select(.region == "europe") | .datacenters | .[] | select(.availability != "unavailable")' /dev/shm/ovh.json) sendTelegram "1801sk13" $jsonfiltrado #curl -s -X POST $URL -d chat_id=$CHAT_ID -d text="$MESSAGE"