ManyChat

Dev Tools: External Request

Dev tools provide much more flexibility in customizing your Bot - let's have a more detailed look at External Request in this article. 

External request (PRO Feature):

External request is a new action available within builder.
This feature allows you to send an HTTP request to your server with different types of data:

  • Subscriber status
  • First name
  • Last name
  • Name
  • Gender
  • Language
  • Timezone
  • Live-chat URL
  • Custom fields

External request function supports GET and POST HTTP methods. To create external request node you need to go to Actions -> External request.

Once you click on Add your request button it will open configuration window.

In configuration window you will be able to choose the request type (GET or POST).

After you have set up your request type, you need to set proper request URL and fill in Headers and Body fields.
Here's the example of External Request body from https://api.manychat.com/swagger#/Sending/post_fb_sending_sendContent:

{
"subscriber_id": 0,
"data": {},
"message_tag": "ISSUE_RESOLUTION"
}

data's {} here filled with Response Format from here: https://manychat.github.io/dynamic_block_docs/.
More info about available headers could be found on the Internet. For example: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers 

When it is done you can test your request by going to Response tab and click on Test the request

If everything is done correctly you will get HTTP 200 Code like that:

Let’s create a default reply flow for Star Wars fans. There are good free API methods called https://swapi.co/. We want to show the film title and the opening crawls by answering any word to the bot. If the word is contained in the title, then we will show the title and the opening crawl.

Firstly, create two CUFs to save the title and the opening crawl. Then go to the Default reply section, create an Action block, and choose External Request.


We'll use an API search method https://swapi.co/api/films/?search=hope and send the last user input there. Next, we need to match JSON response parameters with our CUFs.


Here is our result in the Facebook Messenger.

Hopefully this helps!

PS: We also kindly recommend to read our DevTools Quick Start article to learn more on the subject.