0

I built a bot that is integrated to messenger and default bot on website using dialogflow now the bot have default response and messenger response but when I go to the fullfilment i cant set a specific response for each

here is my code

 function time(agent) {
    if (currentlyOpen()) {
      agent.add(`Hi, We're open now! We close at 11pm today.`);
    } else {
      agent.add(`We're currently closed, but we open every day at 6am!`);
    }
  }

I want to have a diffrent response if I am using messenger as the default response goes to the default bot "I know I can inrtegrate messenger in the website but I want to know this way as I use it for more bots"

bahaa
  • 67
  • 1
  • 11

1 Answers1

0

You can do that using the same library that you are using for agent. To send specific platform response just add the platform to the response. For example, if you want send a text specifically to Google Assistant then you can do that using agent.add(new Text({ text: 'text_here', platform: 'ACTIONS_ON_GOOGLE'}));.

The full Dialogflow fulfillment code is available on GitHub. https://github.com/dialogflow/dialogflow-fulfillment-nodejs. I have also modified some code to set some other responses that are not available in this library such as telephony transfer and speech responses. So, if you want you can do that too.

Satish Pandey
  • 335
  • 2
  • 8