1

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.

1
  • Please help, I haven't found the solution to this yet. Commented Oct 7, 2023 at 23:32

1 Answer 1

1

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})); 
Sign up to request clarification or add additional context in comments.

1 Comment

also had to remove extra Payload object const help = { "text": "Can I help you with anything else?", "reply_markup": { "inline_keyboard": [ [ { "callback_data": "yes", "text": "1 - Yes", }, { "text": "2 - No", "callback_data": "no", }, ], ], }, };

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.