Skip to content

Instantly share code, notes, and snippets.

@fgallaire
Created May 24, 2020 06:06
Show Gist options
  • Save fgallaire/bcf55aa0b657e4da6ba291222d012423 to your computer and use it in GitHub Desktop.
Save fgallaire/bcf55aa0b657e4da6ba291222d012423 to your computer and use it in GitHub Desktop.
TOKEN=
URL=
ok_delete_webhook=`curl -s https://api.telegram.org/bot$TOKEN/setWebhook | jq '.ok'`
pending_update_count=`curl -s https://api.telegram.org/bot$TOKEN/getWebhookInfo | jq '.result.pending_update_count'`
update_id=`curl -s https://api.telegram.org/bot$TOKEN/getUpdates | jq '.result[0].update_id'`
offset=$(($update_id+$pending_update_count))
ok_flush=`curl -s https://api.telegram.org/bot$TOKEN/getUpdates?offset=$offset | jq '.ok'`
ok_set_webhook=`curl -s https://api.telegram.org/bot$TOKEN/setWebhook?url=$URL | jq '.ok'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment