Reputation: 11
I'm building a Telegram chatbot with Dialogflow. I'm using Node.js and Dialogflow's inline editor for fulfillment.
I want my bot to ask "Can I help you with anything else?" with buttons for "yes" and "no", right after my intents. Here's a function for one of my intents:
function form(agent) {
agent.add(
new Card({
title:
"Ok, here's the registration form. Click the button and download the file.",
buttonText: `Form`,
buttonUrl: formDownloadUrl,
})
);
const help = new Payload({
"telegram": {
"text": "Can I help you with anything else?",
"reply_markup": {
"inline_keyboard": [
[
{
"callback_data": "yes",
"text": "1 - Yes",
},
{
"text": "2 - No",
"callback_data": "no",
},
],
],
},
},
});
agent.add(help);
}
In Google Cloud log I'm getting the following error when I try to call the same intent:
Dialogflow fulfillment error : Webhook call failed. Error: UNAVAILABLE, State: URL_UNREACHABLE, Reason: UNREACHABLE_5xx, HTTP status code: 500.
The function was working fine when I only had the Card, but when I tried to add the Payload, it stopped working and it's now giving the error above.
Is the syntax for the Payload correct? Does Dialogflow Fulfillment not support Telegram Custom Payload?
I've also tried creating a different intent for the "help" question without using fulfillment: Response with Telegram Custom Payload in Dialogflow
Then I set this intent as an event and called it inside my "form" function with the setFollowupEvent() method, but this only shows the "help" question, skipping the "form" Card.
Upvotes: 1
Views: 389
Reputation: 183
Please remove telegram node from your payload and add the payload to agent by sending the telegram as platform.
const help = new Payload({
"text": "Can I help you with anything else?",
"reply_markup": {
"inline_keyboard": [
[
{
"callback_data": "yes",
"text": "1 - Yes",
},
{
"text": "2 - No",
"callback_data": "no",
},
],
],
},
});
agent.add(new
Payload(agent.TELEGRAM, help,
{rawPayload: false, sendAsMessage:
true}));
Upvotes: 0