Search code examples
dialogflow-esactions-on-googledialogflow-es-fulfillmenttelegram-webhook

Dialogflow fulfillment answers don't reach Telegram, Facebook and Slack integration


I created a simple bot to test some new resources, but I'm facing an issue with fulfillment responses on some clients. I'm testing with many integrations.

  • ✅ The fulfillment work fine with: Web Demo and Dialogflow Messenger
  • 🔥 The fulfillment fails with: Facebook Messenger, Slack and Telegram

I wrote two intents to test:

  1. "Hello" - Text Response Intent
  2. "Hi" - Fulfillment Intent answered by node using actions-on-google package.

What happened:

  • "Hello" - intent works on all integrations, like expected.
  • "Hi" - intent works like expected with Dialogflow native integrations (✅ )
  • "Hi" - intent doesn't work with other integrations (🔥), but it shows "Typing..." while my node backend creates the answer, but the text response is never showed.

  • In debug mode, I see that the request is received, the intent match, and the Response object are like expected.

Node code:

const { dialogflow } = require('actions-on-google');
const app = dialogflow({ debug: true });

... 

app.intent('Hi', conv => {
  console.log('>> Hi Fulfillment reached');
  conv.ask(`Hi! I'm a fulfillment response on node!`);
});

Node response (console output):

>> Hi Fulfillment reached
Response {
  "status": 200,
  "headers": {
    "content-type": "application/json;charset=utf-8"
  },
  "body": {
    "payload": {
      "google": {
        "expectUserResponse": false,
        "richResponse": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": "Hi! I'm a fulfillment response on node!"
              }
            }
          ]
        }
      }
    }
  }
}
POST /api/chatBot/ 200 156 - 1419.611 ms

I recorded my screen to show better that behavior.

enter image description here

Any help is appreciated!


Solution

  • You are using the actions-on-google nodeJS library. This library is used to build bots on the Actions on Google platform using Dialogflow. You can use it to build some basic things for other integrations, but you might run into limitations as it is build specifically for Google Assistant.

    If you want to build bots for multiple integrations of Dialogflow it is better to use the dialogflow fulfillment library. This is ment for building chatbots for multiple integrations for Dialogflow.

    https://www.npmjs.com/package/dialogflow-fulfillment