Facebook messenger integration - bot does not provide the responses

Ak11

I had integrated the Dialogflow with Facebook messenger integration. I had followed the steps in the dialogflow docs.

I am not getting any output /message from the messenger.

I had used conv.ask() to respond to the Intents, is that the issue?

Do I need to update the surface capabilities section in actions?

'use strict';

  // Import the Dialogflow module and response creation dependencies
  // from the Actions on Google client library.
  const {
    dialogflow,
    BasicCard,

  } = require('actions-on-google');

  // Import the firebase-functions package for deployment.
  const functions = require('firebase-functions');

  // Instantiate the Dialogflow client.
  const app = dialogflow({debug: true});


  function getRandomInt(max) {
    return Math.floor(Math.random() * Math.floor(max));
  }

  const swamiMessages = require('./messages');

  const swamiQuotes =require('./quotes');
  // Intent Mapping 

  //INTENT: 'Default Welcome Intent'.

  app.intent('Default Welcome Intent', (conv) => {
    conv.ask(
        `<speak> <emphasis level="moderate" >   `+
        `Do you want to hear an Inspiring  <break/> Quote or a Message from Swami <break/> Sukhabodhananda ` +
        `Do you want to know about Prasanna Trust <break/>`+
        //`Do you want to know about the upcoming programs` +
      ` </emphasis> </speak>`);
    });

  //INTENT: 'quote'
  //Should get triggered when the user request for an inspiring thought
  // asks for motivation 

  app.intent('quote', (conv) => {
    // when the welcome intent is triggered recite a random quote

    //let quoteNumber= getRandomInt(5);
    //let quote = quotes[quoteNumber].quote; //
      let quote =swamiQuotes.getQuote();

    if (quote) {
        conv.ask(
            `<speak> <emphasis level="moderate" >   `+
            `Let us hear  an Inspiring quote \n` +
            `<break strength="strong"> </break>  `+
            `${quote}` +
            `<break strength="strong"> </break>  `+
            `\nDo you want to hear another quote or message ` +
            ` </emphasis> </speak>`);
        } else
        {
          conv.ask(
            `<speak> <emphasis level="moderate" >   `+
            `Let us hear  an Inspiring quote ` +
            `<break strength="strong"> </break>  `+
            `quotes` +
            `\nDo you want to hear another quote or message ` +
            ` </emphasis> </speak>`);
        }
  });

  // INTENT: message 
  //Should get triggered when the user request for an inspiring message


  app.intent('message', (conv) => {
    // when the welcome intent is triggered recite a random message
    let message =swamiMessages.getMessage();
    //let formattedMessage=swamiMessages.formattedMessage(message);

    conv.ask(
        `<speak> <emphasis level="moderate" >   `+
        `Let us hear  an Inspiring Message ` +
        `<break strength="strong"> </break>  `+
        `${message}`+
        `\nDo you want to hear another quote or message ` +
        ` </emphasis> </speak>`);

    });

Update

If I make changes to use the dialogflow-fulfillment library, how do I add two default handler functions - one for Actions on Google and one for other integrations? I'm doing something like

intentMap.set(null, googleAssistantOther);
intentMap.set(null, other);
//In place of null should i update the Intent Name and 
// googleAssitantOther and other are callback functions. 
Prisoner

You indicated you're trying to integrate this with Facebook, but you're using the actions-on-google library, which is tailored to respond with messages specifically for the Google Assistant.

If you want to write code that responds for both the Assistant, as well as other platform that Dialogflow supports, you may want to look into the dialogflow-fulfillment library.

You do not need to do anything with the surface configuration on the Action console.

Update

You can use the same Intent definitions - that is an important aspect of developing for multiple platforms. And many things (such as text) work exactly the same between the two. For some things (such as wanting to add some RichResponse objects), you may want to check which platform you're running on with code such as

if (agent.requestSource === agent.ACTIONS_ON_GOOGLE) {
  intentMap.set(null, googleAssistantOther);
} else {
  intentMap.set(null, other);
}

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How to use a database with a messenger chat bot to store responses of users?

分類Dev

API authentication from a facebook messenger bot conversation

分類Dev

Facebook Messenger bot using Spring Boot?

分類Dev

“Get Started” button does not appear for FB Messenger bot on Messenger app

分類Dev

Facebook Messenger Bot sharing structured message with postback button

分類Dev

The URL couldn't be validated Facebook Messenger Chat Bot

分類Dev

Removing Messenger Chatbot Default Quick Responses

分類Dev

Facebook Messenger Botは、グループ内の2人以上の人とチャットできますか?

分類Dev

Facebook Messenger Bot、テストユーザー、誰かがこれを機能させましたか?

分類Dev

facebook-messenger-bot error: When & why this error raised "(#100) Length of param name_placeholder[text] must be less than or equal to 640"

分類Dev

Calling Facebook Messenger API in a synchronous fashion

分類Dev

No node for selector while using puppeteer on facebook messenger

分類Dev

Facebook Messenger notification sound doesn't work

分類Dev

Does Messenger Plus! contain any spyware?

分類Dev

Cannot connect bot to Bale messenger API: network connection disconnected

分類Dev

Facebook Messenger APIの使用方法は?

分類Dev

Facebook Messenger APIWebhookのトラブル

分類Dev

Facebook Messenger承認ポリシー

分類Dev

Create a bot for a closed facebook group

分類Dev

Is Facebook Chat integration possible with API 2?

分類Dev

Does the iOS SDK provide queues and stacks?

分類Dev

webpack code splitting: does it provide browser caching

分類Dev

Does firebase provide any form of test tokens?

分類Dev

Does Canon provide SDK documentation to their camera's

分類Dev

Why does this provide me with a stack overflow error?

分類Dev

What functionality does the Ubuntu Restricted Extras provide?

分類Dev

facebook-messenger-botエラー:このエラーが発生した時期と理由「(#100)param name_placeholder [text]の長さは640以下である必要があります」

分類Dev

Facebook Messenger API:ブラウザで開くWebビュー

分類Dev

Facebook Messenger拡張機能をデバッグする方法は?

Related 関連記事

  1. 1

    How to use a database with a messenger chat bot to store responses of users?

  2. 2

    API authentication from a facebook messenger bot conversation

  3. 3

    Facebook Messenger bot using Spring Boot?

  4. 4

    “Get Started” button does not appear for FB Messenger bot on Messenger app

  5. 5

    Facebook Messenger Bot sharing structured message with postback button

  6. 6

    The URL couldn't be validated Facebook Messenger Chat Bot

  7. 7

    Removing Messenger Chatbot Default Quick Responses

  8. 8

    Facebook Messenger Botは、グループ内の2人以上の人とチャットできますか?

  9. 9

    Facebook Messenger Bot、テストユーザー、誰かがこれを機能させましたか?

  10. 10

    facebook-messenger-bot error: When & why this error raised "(#100) Length of param name_placeholder[text] must be less than or equal to 640"

  11. 11

    Calling Facebook Messenger API in a synchronous fashion

  12. 12

    No node for selector while using puppeteer on facebook messenger

  13. 13

    Facebook Messenger notification sound doesn't work

  14. 14

    Does Messenger Plus! contain any spyware?

  15. 15

    Cannot connect bot to Bale messenger API: network connection disconnected

  16. 16

    Facebook Messenger APIの使用方法は?

  17. 17

    Facebook Messenger APIWebhookのトラブル

  18. 18

    Facebook Messenger承認ポリシー

  19. 19

    Create a bot for a closed facebook group

  20. 20

    Is Facebook Chat integration possible with API 2?

  21. 21

    Does the iOS SDK provide queues and stacks?

  22. 22

    webpack code splitting: does it provide browser caching

  23. 23

    Does firebase provide any form of test tokens?

  24. 24

    Does Canon provide SDK documentation to their camera's

  25. 25

    Why does this provide me with a stack overflow error?

  26. 26

    What functionality does the Ubuntu Restricted Extras provide?

  27. 27

    facebook-messenger-botエラー:このエラーが発生した時期と理由「(#100)param name_placeholder [text]の長さは640以下である必要があります」

  28. 28

    Facebook Messenger API:ブラウザで開くWebビュー

  29. 29

    Facebook Messenger拡張機能をデバッグする方法は?

ホットタグ

アーカイブ