Chatfuel

Plugins

What are plugins?

Plugins are tools to make your bot much more powerful. They can connect to your existing content or API through for example the Google search, Bing search, JSON API or the RSS Import plugins.

The Subscribe plugin allows you to quietly subscibe user to a plugin’s feed, Subscription list makes it possible to show your bot’s user all the feeds they’re subscribed to and Digest delivers a personalised news feed to your users, which they can adapt by removing and adding subscriptions from other plugins.

IFTTT and Zapier allow you to easily connect your existing social network feeds and lots more to your Chatfuel bot.

User input lets you to gather information from your users and send it to your API or use in other plugins as parameters and the Live Chat plugin makes it possible to request support from your Facebook page’s admin.

RSS Import

The RSS plugin allows you to show content from RSS feeds beautifully in your bot. Many blogging platforms like WordPress offer RSS feed support out of the box and this plugin makes it easy to show new articles (from your website or any other) in your chat bot.

plgns_rss_01

You can

  • use Image Title to define a text to show on the image of the last card
  • set up the amount of items to show in the gallery
  • allow users to subscribe to their search results (use the Digest plugin to deliver the feeds, users have subscribed to)
  • use this format parameter to add saved parameters in
    • URL
    • Image Title
    • Subscriptions Management Card Title
  • allow users to read content right in the bot. This only works if the  of the items in the feed has more than 1000 symbols.

Subscriber

This powerful plugin allows you to subscribe user to an RSS feed or a Bing/Google search result without showing actually showing the feeds first.

For example, you can subscribe a user by a simple button click as shown in the image below:

This plugin will only work for Google/Bing search plugins with defined queries. If you define a query with the User Input plugin and you link the Subscriber plugin to the block with this search plugin it will not work for example, as it does not know which query to subscribe to.

Subscriptions list

This plugin shows a gallery of all feeds a user is subscribed to. It allows to get the latest stories and to unsubscribe from each subscription.

If you for example have RSS Input plugin with a newsfeed from your website and a Google Search plugin, that works with User Input as a search on your website and your user subscribed to both, this is what it could look like:

Best practice is to make it easy for your users to get to this plugin. After all, it’s in your interest to make it easily accessible for your users, so that your bot’s block rate stays at a healthy minimum.

Because it’s possible that a user accesses the Subscription List plugin without actually having any subscriptions you need to link another block which will be shown instead:

Digest

If you have a lot of information on your website and your bot users use a lot of subscriptions this is the ideal plugin for you. The Digest plugin accumulates all new content from a user’s personalised subscriptions which was not displayed yet.

Best practice is to trigger Digest using Scheduled Events or Recurrent Events in the broadcasting tab.

IFTTT

IFTTT is a powerful automation tool that allows you to link a massive amount services like Instagram, Twitter, YouTube, Chatfuel and much more to each other. For example you can set up that if you upload a new image to your Instagram feed, IFTTT adds this image to a gallery in your bot.

You can chose how to show IFTTT results:

  • a single card showing only the lastly added item
  • a gallery which can show a history the last 9 items

TODRAW

The settings for the YouTube and Twitter integrations are the same as for Instagram.

Remember: IFTTT plugins don’t automatically send a message to your users when new content is added. Please broadcast them using Scheduled Events and Recurrent Events or show them in the structure of your bot.

Zapier

Use this plugin to create a gallery that will be dynamically updated by Zapier.

For example, you can make a gallery of your photos from Instagram or a gallery with last documents from Google Docs.

To create such plugin, follow these steps:

  1. Go to Chatfuel dashboard.

  2. Go to some block at a bot.

  3. Hover (+) sign at the bottom of the block.

  4. Tap Plugins.

  5. Select Zapier plugin.

  6. Authenticate in Chatfuel for Facebook app at Zapier using key from plugin.

  7. Create zap at Zapier with Chatfuel for Facebook as an Action App.

  8. Come to this block in FB Messenger and check that update is shown.

JSON API

Use this plugin to create various integrations with your server – generate dynamic content or send data. You can apply user attributes in either the URL or the USER ATTRIBUTES field. With POST request type, user attributes will be sent in a standard way. With GET request, they will be added to the URL as GET parameters.

To add an attribute to the URL field just type {{ in the URL field.

Chatfuel makes a simple GET or POST query to your API, then renders the response straight to the user and/or set user attributes. You can use any content type header for this.

All web_url buttons support Messenger Extensions. You need to whitelist your domain in Configure tab to enable Messenger Extensions for your JSON API web_url buttons.

If you are looking for an easy and fast way to setup your own endpoint for JSON plugin, check out this short tutorial.

Also check out our Broadcasting API. It allows to send a custom message to one of the users on a given trigger

Here are examples of JSON format to be used:

Here is how you can send two text messages:

{
 "messages": [
   {"text": "Welcome to our store!"},
   {"text": "How can I help you?"}
 ]
}

Send an image:

{
  "messages": [
    {
      "attachment": {
        "type": "image",
        "payload": {
          "url": "https://petersapparel.parseapp.com/img/item101-thumb.png"
        }
      }
    }
  ]
}

Send a file:

{
  "messages": [
    {
      "attachment": {
        "type": "file",
        "payload": {
          "url": "https://chatfuel.com/PrivacyPolicy.pdf"
        }
      }
    }
  ]
}

Send a video*:

{
  "messages": [
    {
      "attachment": {
        "type": "video",
        "payload": {
          "url": "https://petersapparel.parseapp.com/img/item101-video.mp4"
        }
      }
    }
  ]
}

* video should be in MP4 format and no larger than 20MB.

Send an audio*:

{
  "messages": [
    {
      "attachment": {
        "type": "audio",
        "payload": {
          "url": "https://archive.org/download/Dictaphones_Lament/TychoDictaphones_Lament.mp3"
        }
      }
    }
  ]
}

* audio should be in MP3, OGG, WAW format and no larger than 10MB.

Send a text card with two buttons, one of which points to a block, another one to a URL:

{
  "messages": [
    {
      "attachment": {
        "type": "template",
        "payload": {
          "template_type": "button",
          "text": "Hello!",
          "buttons": [
            {
              "type": "show_block",
              "block_name": "some block name",
              "title": "Show the block!"
            },
            {
              "type": "web_url",
              "url": "https://petersapparel.parseapp.com/buy_item?item_id=100",
              "title": "Buy Item"
            }
          ]
        }
      }
    }
  ]
}

Send a gallery:

{
 "messages": [
    {
      "attachment":{
        "type":"template",
        "payload":{
          "template_type":"generic",
          "elements":[
            {
              "title":"Classic White T-Shirt",
              "image_url":"http://petersapparel.parseapp.com/img/item100-thumb.png",
              "subtitle":"Soft white cotton t-shirt is back in style",
              "buttons":[
                {
                  "type":"web_url",
                  "url":"https://petersapparel.parseapp.com/view_item?item_id=100",
                  "title":"View Item"
                },
                {
                  "type":"web_url",
                  "url":"https://petersapparel.parseapp.com/buy_item?item_id=100",
                  "title":"Buy Item"
                }
              ]
            },
            {
              "title":"Classic Grey T-Shirt",
              "image_url":"http://petersapparel.parseapp.com/img/item101-thumb.png",
              "subtitle":"Soft gray cotton t-shirt is back in style",
              "buttons":[
                {
                  "type":"web_url",
                  "url":"https://petersapparel.parseapp.com/view_item?item_id=101",
                  "title":"View Item"
                },
                {
                  "type":"web_url",
                  "url":"https://petersapparel.parseapp.com/buy_item?item_id=101",
                  "title":"Buy Item"
                }
              ]
            }
          ]
        }
      }
    }
  ]
}

Keep in mind that you can combine several messages in one answer by sending several dictionaries in the messages array.

Send a list template:

{
  "messages": [
    {
      "attachment": {
        "type": "template",
        "payload": {
          "template_type": "list",
          "top_element_style": "large",
          "elements": [
            {
              "title": "Classic White T-Shirt",
              "image_url": "http://petersapparel.parseapp.com/img/item100-thumb.png",
              "subtitle": "Soft white cotton t-shirt is back in style",
              "buttons": [
                {
                  "type": "web_url",
                  "url": "https://petersapparel.parseapp.com/buy_item?item_id=101",
                  "title": "Buy Item"
                }
              ]
            },
            {
              "title": "Classic Grey T-Shirt",
              "image_url": "http://petersapparel.parseapp.com/img/item100-thumb.png",
              "subtitle": "Soft gray cotton t-shirt is back in style",
              "buttons": [
                {
                  "type": "web_url",
                  "url": "https://petersapparel.parseapp.com/buy_item?item_id=100",
                  "title": "Buy Item"
                }
              ]
            }
          ]
        }
      }
    }
  ]
}

You can switch type “top_element_style” between “large” and “compact”.

Link to a block

You can also link to a block in your bot’s structure by using this syntax in the buttons array:

{
  "type": "show_block",
  "block_name": "Finish",
  "title": "Finish Shopping"
},
{
  "type": "show_block",
  "block_names": ["Block1", "Block2"],
  "title": "Finish Shopping"
}

You can use either block_name to link to one block or block_names to link to several blocks.

Quick Reply

{
  "messages": [
    {
      "text":  "testRedirectInQuickReply",
      "quick_replies": [
        {
          "title":"go",
          "block_names":["Block1", "Block2"]
        }
      ]
    }
  ]
}

Postback

New request to your JSON API can be done after clicking on a button (both Quick Reply and regular buttons are supported).

{
  "messages": [
    {
      "attachment": {
        "payload":{
          "template_type": "button",
          "text": "test JSON with postback",
          "buttons": [
            {
              "url": "http://pastebin.com/raw/bYwUN7un",
              "type":"json_plugin_url",
              "title":"go"
            }
          ]
        },
        "type": "template"
      }
    }
  ]
}

Redirect to blocks

You can redirect a user to a block or to a sequence of blocks. No action is needed from a user.

{
  "redirect_to_blocks": ["block title 1", "block title 2"]
}

Set user attributes

Also, we enabled setting user attributes in JSON by clicking a button (not only Quick Reply, but all other buttons too). Here is what code for a button should look like *:

{
  "set_attributes": 
    {
      "some attribute": "some value",
      "another attribute": "another value"
    },
  "block_names": ["BlockWithUserAttributes"],
  "type": "show_block",
  "title": "go"
}

* Please note that setting attributes works only for show_block and json_plugin_url button types because we need to be able to receive postbacks from Facebook.

You can now also set user attributes in our JSON plugin without or prior to showing anything to the user — it comes in handy when you have advanced logic of user segmentation on your backend. After that, you can use these new, advanced segments in the Broadcasting tab.

{
  "set_attributes":
    {
      "some attribute": "some value",
      "another attribute": "another value"
    },
  "messages":[
    . . .
  ]
}

Share and Call buttons *

{
  "messages":[
    {
      "attachment":{
        "type":"template",
        "payload":{
          "template_type":"generic",
          "elements":[
            {
              "title":"Classic White T-Shirt",
              "image_url":"http://petersapparel.parseapp.com/img/item100-thumb.png",
              "subtitle":"Soft white cotton t-shirt is back in style",
              "buttons":[
                {
                  "type":"phone_number",
                  "phone_number":"+79268881413",
                  "title":"Call"
                },
                {
                  "type":"element_share"
                }
              ]
            }
          ]
        }
      }
    }
  ]
}

* Please note that the share button works only in gallery cards due to Facebook API constraints.

Airline templates

For airline templates our JSON format is very similar to Facebook’s. Here is four possible airline templates’ code:

More examples

The JSON plugin currently does not support more than 10 messages per request or subscribing users to any results.

Timeout for a request is 60 seconds.

User Input

The User input plugin helps you to collect input from your user for further use.

User input has four different outputs:

  • Email — You receive an email on each completion of the plugin.
  • Callback — When the plugin is completed your server will receive a callback with the answers. For this both the GET and POST methods are supported.
  • Show URL — If you want your user to be linked to a specific web page based on his answers, choose this variant. The parameters will then be appended to the link.
  • Save Parameters — This will turn the parameters into global attributes for further use in your bot. A plugin which supports this is for example JSON API. There you can use parameters in the URL to generate different results.

After each completion of the User Input» we by default send this text card to your bot’s users, but this can be deleted or customised in the dashboard.

The User Input plugin can collect images, *.docx, *.xlsx, *.pdf files and all other formats supported my Facebook Messenger.

Live Chat

Live Chat allows your users to get in touch with your support team using your Facebook bot.

  • The plugin’s welcome message and the final card are customizable
  • If users start the chat and do not stop it by themselves, Chatfuel will keep the session open for an adjustable timeframe. After the time runs out we automatically stop the chat session and the next user’s input will be recognised by the AI.
  • Each time a user starts a new chat session, you get push notification from your bot with a link to your Facebook Page’s Messaging section where you can answer your user. To do this you have to:
    • connect your bot to Facebook Page
    • click the blue ribbon at the bottom of the plugin to confirm you’re the manager of the chat bot