watson-developer-cloud / conversation-connector

The Conversation connector is a set of components that mediate communication between your Conversation workspace and a Slack or Facebook app. Use the connector to deploy a chat bot that Slack or Facebook Messenger users can interact with.
Apache License 2.0
28 stars 62 forks source link

Send Button/Image JSON via Watson #51

Closed mbordash closed 6 years ago

mbordash commented 6 years ago

Hi team,

I'm a DE over in Watson Customer Engagement. We're implementing Watson Assistant for our Facebook page. Can you advise how I can send a button or an image via Watson Assistant/Conversation response? Essentially this json:

https://developers.facebook.com/docs/messenger-platform/send-messages/template/button

I'd like to add a Follow button to our dialog flow to make it easy for a customer to follow Watson via a messenger bot chat.

Thanks,

Michael

dgterry commented 6 years ago

Hi @mbordash you should be able to directly put Facebook JSON into your dialog nodes to accomplish this. Basically in the output object create a facebook object and then place the payload object from the link you provided. See here: https://github.com/watson-developer-cloud/conversation-connector#interactive-messages , there is a small facebook example if you scroll past the slack one.

mbordash commented 6 years ago

Nice!

-1 for me not looking hard enough. Will give it a shot.

mbordash commented 6 years ago

Just in case others want to know, this is the payload I used to send a button of type url through watson to facebook:

{
  "output": {
    "facebook": {
      "message": {
        "attachment": {
          "type": "template",
          "payload": {
            "text": "Hi,\n\nWe have a great giveaway for you, but first we’d like for you to follow us so that you can stay updated on the latest news and trends.\n\nPlease take a moment to follow us and let me know when you've followed us by typing DONE:\n\n",
            "buttons": [
              {
                "url": "https://www.facebook.com/ibmcommerce/",
                "type": "web_url",
                "title": "Follow IBM Commerce",
                "messenger_extensions": "false",
                "webview_height_ratio": "full"
              }
            ],
            "template_type": "button"
          }
        }
      }
    }
  }
}
dgterry commented 6 years ago

Glad it seems like you got this all working. If that is not the case please open a new issue for further discussion.