Using the "Get" Connection

Updated 2 weeks ago by Dan Golder

The "Get" Connection Pulls Data into Your Bot

Warning: this is an advanced, developer feature.

You can pull data into your bot using a "Get" Connection.

Use the GET connection to pull data from your own API, and either save that data down to Attributes in your bot or forward it right along to Facebook as part of a conversation with a contact.

To retrieve data from an API and save it to Contact attributes

You can use data gathered in a chat conversation to retrieve data stored in another system which can they be saved and displayed in that same (or subsequent) chat conversations.

Example: ask a contact for their email address and use that to retrieve their package's estimated arrival date from an internal orders database.

Your API should return a simple JavaScript object:

{
"attribute1" : "value1",
"attribute2" : "value2"
}

In the above example, when this connections is triggered (either by a widget or by an Audience condition), value1 and value2 will be applied to attribute1 and attribute2 for the contact.

If the attributes don't yet exist, they will be created. If values already exist for these attributes for the contact, they will be overwritten.

To pass through data from an API to a bot conversation

Another options is to retrieve data from your API formatted as a text or image message to be delivered directly to the contact in conversation.

Example: The user provides you with a zip code, and you send them a picture and description of a home you have for sale in or near that zip code.

Sample JSON response for a text message:

{
"text" : "hello, world!"
}

Sample JSON response for an image message:

{
"attachment":{
"type":"image",
"payload":{
"url":"https://images.pexels.com/photos/67636/rose-blue-flower-rose-blooms-67636.jpeg",
"is_reusable":true
}
}
}

If there are other types of Messenger formats you'd like to see support for in this feature, please contact us at product@mobilemonkey.com


How did we do?