question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ctx.reply() doesnt return data when using web hook

See original GitHub issue

Is there a way to get message_id from a just sent message when using web hook?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
dotcypresscommented, May 14, 2018

Basically, ctx.reply is just shortcut to ctx.telegram.sendMessage. If you wanna disable response to webhook, you can use ctx.webhookReply prop:

bot.command('test', ctx => {
  ctx.webhookReply = false
  // will use rest api for service call
  ctx.telegram.sendMessage(ctx.message.from.id, 'Test message')
    .then(data => console.log(data))
    .catch(err => console.error(err))

  ctx.webhookReply = true
  // will use webhook response for service call
  ctx.telegram.sendMessage(ctx.message.from.id, 'Test message2')
    .then(data => console.log(data))
    .catch(err => console.error(err))

})

Related issues: https://github.com/telegraf/telegraf/search?q=webHookReply&type=Issues

2reactions
Otto-AAcommented, May 14, 2018

Don’t use ctx.telegram.sendMessage but bot.telegram.sendMessage (or with your namings it’s probably Handler.telegram.sendMessage. Then it should work 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Telegraf and Heroku not sending the first reply on webhook ...
I want to add some feedback while the server works, so I add a ctx.reply("searching...") after the command right before the function getdata...
Read more >
API Reference - Discord.py
After this, the bot can be considered “re-opened”, i.e. is_closed() and is_ready() both return False along with the bot's internal cache cleared. await...
Read more >
Webhooks - VerneMQ
The VerneMQ Webhooks plugin provides an easy and flexible way to build powerful plugins for VerneMQ using web hooks. With VerneMQ Webhooks you...
Read more >
files.upload method - Slack API
This method allows you to create or upload an existing file. You must provide either a file or content parameter. The content of...
Read more >
Interactions - Discord
Deletes the initial Interaction response. Returns 204 No Content on success. Create Followup Message. POST/webhooks/{application.id} ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found