Responses

Every Dialogflow intent contains an area to create a response. You can respond directly in Dialogflow with text, and adding multiple lines of text will randomize a text response for the user.

Dialogflow Response for Manychat

Responding With Manychat Flows

If you want to respond with a Manychat Flow, click the trash can in the text response to remove it.

Dialogflow Response for Manychat

Click Add Responses.

Dialogflow Response for Manychat

Choose Custom Payload.

Dialogflow Response for Manychat

You’ll need to add 3 lines of JSON code to a Custom Payload response that will tell Dialogflow to redirect back to a Manychat Flow. If you roll your mouse over the block below, you can copy this code to your clipboard. You'll replace contentXXXXXXXX with your own Flow ID's

{
  "flow": "content20181121085445_482861"
} 

Now you’ll need to get a Flow ID for the Flow you want to respond with. To get the Flow ID, go to the Flow in ManyChat and look at the end of URL. You might see the URL looks like this:

Dialogflow Response for Manychat

In this example you’ll want to copy content20180731060101_855794 from the URL and paste that into your Custom Payload response to set up the redirection.

Dialogflow Response for Manychat

If your Flow lis in a Manychat folder, then ManyChat will add some extra characters in the URL. You’ll want to ignore the first set of characters and the dashes (these represent the folder), and copy everything after the dashes. For example, you would just copy content20180718210141_526593. That’s your Flow ID (don’t copy 87222- -)

Dialogflow Response for Manychat

Responding from Dialogflow with Manychat Custom Fields

You can create a basic text response in Dialogflow, or you can include Custom User Fields in your text responses. You would include #janis.custom_field_name. For example, if you want the subscriber's name in the response you would use #janis.first_name.

Dialogflow Text Response for Manychat

In this example, page_id was included. You might respond with a link to your Messenger bot.

Dialogflow Text Response for Manychat

Here is a list of fields you can add into a Dialgflow text response. Manychat passes this data to Janis:

#janis.page_id A unique identifier for a Facebook page. Respond to a user with https://m.me/#janis.page_id
#janis.first_name The first name of the Facebook user.
#janis.last_name The last name of the Facebook user.
#janis.name The first and last name of the Facebook user
#janis.gender Male or female

You can pass any Custom User Field from Manychat and include them in a Dialogflow text response, but you would need to make sure to replace any spaces in a Custom User Field name with an underscore. Best practice is to name your Custom User Fields with an underscore instead of spaces.

Combining Dialogflow and Manychat Flow Responses

Here you'll see that there is a text response that will mention the user by their first name, followed by a Custom Payload response that will redirect to Manychat.

Dialogflow Text Response for Manychat

Here is what that would look like in Messenger:

Dialogflow Text Response for Manychat