Skip to content Skip to sidebar Skip to footer

Facebook Messenger And Dialogflow:: Detect Each Event Individually From Multiple Generic Templates Button

I am working with chatbot and dialogflow is my nlp platform. Currently, I am using generic templates to show my products on messenger. Now, when customer clicks on buy now button f

Solution 1:

You can use the payload field in the postback button to send a specific message back to dialogflow when the button is clicked.

If you combine this with the parameters, you can use them to trigger specific intents, or just to send the information of the product clicked. For example:

Imagine an intent with the following phrases:

Training phrases

In this case: "toaster" and "microwave" are part of an entity called objects

Parameters

In the response to messenger, you can include reference to this parameter, for example:

{
  "facebook": {
    "attachment": {
      "type": "template",
      "payload": {
        "template_type": "button",
        "buttons": [
          {
            "payload": "trigger buy $objects",
            "title": "Buy Now",
            "type": "postback"
          }
        ],
        "text": "Buy the $objects!"
      }
    }
  }
}

Which will show the parameter:

Messenger example

When the user clicks on the button, messenger will send dialogflow the content of the payload, in this case: "trigger buy toaster". Note that in the payload the reference $objects is also replaced by the actual parameter "toaster".

So you can create a new intent in Dialogflow with training phrases as "trigger buy toaster" to catch these actions with the object that is going to be purchased.

You can also use the webhook fulfillment to add more logic to the generation of the postback button responses and to the intent that receives the answer.

Post a Comment for "Facebook Messenger And Dialogflow:: Detect Each Event Individually From Multiple Generic Templates Button"