Bernedette Perera
Bernedette Perera

Reputation: 29

Facebook Messenger Bot Dialogflow: Get Responses through webhook using Firebase HTTP Request

I have created a simple bot from Dialogflow and connected to Webhook Fulfillment using my Firebase HTTP request. Then I have integrated the project with FB messenger and did all the configurations. The problem is I'm not getting any responses from the Webhook to the messenger bot.

This is what I have done: I have created two files.

(Index.js)

const functions = require('firebase-functions');
const appModule = require('./routes/api'); //calls my api.js file

module.exports = {
    'api': functions.https.onRequest(appModule)
}

(routes/api.js)

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


app.intent('favoriteColor', (conv) => {
    console.log('in second intent!!');
    conv.close('BTW you look great!');
});

module.exports = app;

So when I test this in Dialogflow chat or in Google Assistant Simulator, it works perfectly. (See below image)

simulator on google assistant

Then when I test this on Facebook messenger, I dont get the response from the webhook. The only response that comes to the FB bot is from Dialogflow Response then it stops once the responses comes from webhook. (See image below)

fb messenger bot

This is my logs from the firebase. (See image below)

firebase logs

As you can see, no errors are in the logs, the response is being sent but it's not coming to my Facebook messenger bot.

What could be the problem? Thank you.

Upvotes: 0

Views: 656

Answers (1)

Prisoner
Prisoner

Reputation: 50701

The actions-on-google library is designed to only return responses that are built for the Google Assistant.

If you want responses for other platforms, you need to use a library that will send replies that are multi-platform, such as dialogflow-fulfillment.

Upvotes: 2

Related Questions