botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
68 stars 83 forks source link

Telegram Postback #1053

Open BPMJoannette opened 4 years ago

BPMJoannette commented 4 years ago

Postback action in carousels doesn't work with Telegram.

You will need a bot on Telegram to reproduce, see : https://core.telegram.org/bots#3-how-do-i-create-a-bot Also, use this bot in which an example of the postback is ready : https://botpress.com/docs/assets/bot_carouselexample_1573577470073.tgz

Steps to reproduce the behavior:

  1. From the admin/modules page, unpack and enable Channel - Telegram
  2. Import the bot carouselexample
  3. In the code editor, under Module Configurations > Global, right click channel-telegram.json, then Duplicate to current bot
  4. In the bot-scoped telegram configuration, add your bot token as instructed in Setup
  5. Restart the server
  6. Talk to the bot in Telegram, select Montreal or New York

TypeError: Cannot read property 'text' of undefined

Expected behaviour: Postback does not return an error.

Environment:

BPMJoannette commented 4 years ago

On the forum, Shone wrote

This error come from here “ctx.message” Property in the sendEvent function . when you click on the button of postback you should receive the “ctx.callbackQuery” Property instead of “ctx.message”.

Solution: follow your URL (\dist\backend\client.js:33:26) call “ctx.callbackQuery” when you click postback and “ctx.message” when you typing.

property ‘text’ just exist in ctx.message and property ‘data’ in ctx.callbackQuery

Like the below image! hope it can help! image

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

EFF commented 2 years ago

Reproduced, keeping this as an actual issue