Using Template Button

(Robert Cavalcante) #1

Hi! :slight_smile: .

I have 2 problems :

  1. I am trying to create a Template Button in Flowxo but i’m having some difficulties.

I want to do this (see the image below), but I don’t know the best way to do.

I tried to use the “Make a Custom Request”, using the json template found on https://developers.facebook.com/docs/messenger-platform/send-api-reference/button-template.

The button template is loaded on the chat, but I can’t figure out how to get the selected choice which user has clicked on.

Example :

I want show to the user a button template with a message and two options : yes and no. If user click on “yes”, i want to redirect the flow to another. If user click on “no”, send to another flow. How I capture which button user had clicked?

  1. When i’m using “Make Custom Request” the flow does not wait for user interaction.

How can I send to the user a Template Button and wait for the user click in one option to continue the flow?

Best regards,

Robert

How to select a choice from the Card Set
(Bob) #2

Use the Ask A Question bot with Choices. Or you could also use the Send Message bot and create the logic to read the answers and redirect them to other flows.

(Robert Cavalcante) #3

Thank you for the quick reply.

I can’t use Ask a Question with Choices because after the user choose an option, the other options disappear from the history of the chat. I need to keep them.

I already did it what you said, it works. But now, I need to keep all the options all along the conversation, thats why i can’t use the Facebook Quick Reply and have to use the Template Button instead.

Thank you for the help.

Best regards,

Robert

(Matt Durr) #4

Have you checked the logs on the Flow to see what data is returned after the user clicks?

Since it is outside of a FlowXO Flow, the response likely comes back separately and would be picked up by a Catchall Flow (if you have one set up).

(Karen Barker) #5

Hi there,

In the custom request, your buttons need to be of the form postback and you will need to send a payload on the buttons. The value in the payload is then the value that is passed as the keyword trigger for the next flow.

A sample JSON request for this would be as follows:

{
    "attachment":{
      "type":"template",
      "payload":{
        "template_type":"button",
        "text":"What do you want to do next?",
        "buttons":[
          {
            "type":"postback",
            "title":"Show Website",
            "payload":"Website"
          },
          {
            "type":"postback",
            "title":"Start Chatting",
            "payload":"Chat"
          }
        ]
      }
    }
  }

In this example your other flows would need keyword triggers of either Website or Chat and would then trigger based on the button clicked by the user.

Hope this helps :slight_smile:

(Anish Duggal) #6

@KarenBarker

Hello,
How can I use the postback from the above code in a filter in the next action?

Instead of using the postback to launch another flow. I need the buttons to stick around so the user can go back to them.

(Karen Barker) #7

Hi Anish,

Using the custom request above the buttons should remain in the chat window and a user could click a previous button.

Unfortunately however there is no way to change the functionality of the postback. This will always try to trigger a new flow. A workaround here however could be to ask a question immediately after making the custom request. The question will be asked too quickly for the user to have already clicked one of the buttons and therefore when they do click one it will be taken as the answer to the question and you could at that point then use the answer to the question as a filter to later tasks in the flow.

Hope this helps. :slight_smile:

(Anish Duggal) #8

Thank you will try it out.