Error message: Bad Request: inline keyboard expected for "Ask a question" action

(Yannick) #1

I’m trying to broadcast a poll to a Telegram channel using the Question “Ask a question” action but get this error when I view the broadcast details:

Error message: Bad Request: inline keyboard expected

Looks like Telegram supports polls: https://core.telegram.org/bots/api#sendpoll and the fields look similar to the “Ask a question” action.

Is it even possible to send polls/question to Telegram channels, and if so, why do I get this error message, and how can I resolve this?

(Nathan Stults) #2

Hi,

You’ll need to share your flow with support@flowxo.com so we can understand exactly what you’re doing that is producing that error. Is definitely possible to send a poll using a Make Custom Request action, but we do not currently process the poll responses as they arrive.

Nathan

(Yannick) #3

Thanks for the quick response!

You can install the flow via https://flowxo.com/share/6dppn2vv.

The flow is called with a GET request with URL variable ‘channel’ to build the correct response path ({{receive_a_webhook.bot_id}}/c/{{receive_a_webhook.channel}}).

When I do the get request I get a 200 response which is correct. But when I look at the broadcast details in https://flowxo.com/app/broadcasts it gives a status “failed” with said error message.

Other actions like “Send a message” and “Send an image”, seem to work fine.

(Nathan Stults) #4

It looks to me like on the broadcasts that failed you didn’t specify any text for the question. I do see you have the question text set to Question? now - if that was always set that way, then maybe we have a weird bug where we don’t see the text “Question” as a question - unlikely but possible I suppose.

Or, you only recently set the question text to a non-empty string. In any case, please try the following:

Change the text of your question to something else, like “Here is a question”
Try your broadcast again

If it works, change your question text back to Question?
If it doesn’t work, let us know, we have a bug.

If it does work, maybe it wasn’t set properly before?

Nathan

(Yannick) #5

The input was always set but changed it to be sure to “What’s the answer to the universe?” but the error persists. The “Question” param seems to still be empty:

(Nathan Stults) #6

There is definitely something strange going on - we’ll have to dig in a little deeper, but one thing I just realized is that you are using a Broadcast trigger and explicitly setting the Response Path - this is definitely not what you want to do, because a Broadcast Trigger will execute once per every user subscribed to your bot, but you will always be sending a message to the channel, so if you had 10 users, you would send 10 messages to the channel.

I doubt that is causing your problem, but even so could you set up your flow with a non-Broadcast Webhook Trigger and let me know the results.

Thanks,

Nathan

(Yannick) #7

Ah, that makes sense. Made a new flow with a regular Receive Webhook trigger, but the problem persists: https://flowxo.com/share/png789kj, with the same error inline keyboard being expected.

Sending just a normal message in the same flow works fine.

(Nathan Stults) #8

Ok thanks - it was a bug, we were not sending inline keyboards when the destination was a channel, which is required by telegram - I believe that if you try it now, it should work.

Nathan

(Nathan Stults) #9

Also, if what you really want is to send a poll to your users, here is an example that accepts a webhook POST with a payload of { response_path:“xxx”, question:“xxx” } and sends a message, a normal question, and then a poll.

There is currently not a way for your bot to consume the poll results, but they are tabulated by Telegram and updated to the channel.

(Yannick) #10

Cool, thanks for fixing so quickly. The link https://fxo-core.ngrok.io/share/rn73wyma seems to be broken though.

(Yannick) #11

For anyone else wondering, I solved this by making an HTTP request to the sendPoll method from the Telegram API directly: https://core.telegram.org/bots/api#sendpoll.

Thanks for the support Nathan.

(Nathan Stults) #12

Nice work! Here’s a corrected link on how to do the same thing using a Custom Request:

(Nathan Stults) #13

Please see this newly released Telegram related feature - it will help you send polls, plus do many other things in Telegram without writing a bunch of custom requests: https://support.flowxo.com/article/257-telegram-actions. And here for customizing keyboards: https://support.flowxo.com/article/258-telegram-keyboards