Chatfuel

Broadcasting

What’s «Send now»?

With «Send now», you instantly send to all your bot users messages you build in «send now».

You can send message with text cards, image cards, galleries and plugins. You can’t send Forms because they can break current users sessions, so if you want to get forms filled, send a message with a button connected to the existing form in structure.

All your bot subscribers will instantly get this broadcasting message. If you want to delay your message — use «Sent on schedule». If you want to send repeated content, for example, daily digest of your news from RSS feed, use «Recurrent events».

What’s «Send on schedule»?

With Send on schedule, you can create a plan of messages at exact days and time.

  • You can send up to two scheduled messages a day.
  • All scheduled messages will use the time zone defined in Settings. By default it’s your bot admin’s time zone.
  • You cannot send the user input plugin in scheduled messages. If you want your users to fill those out for feedback or similar, please send a message with a button connected to the existing user input plugin in your bot’s structure.

What are «Recurrent Events»?

Recurrent events are the perfect way to send your users digests from the plugins they have subscribed to.

For each recurrent event you can:

  • set the time when the message will be send
  • choose whether to use the bot’s or each user’s time zone to send out the broadcasts. You can change this using the Preferences button
  • choose days on which you want to send the broadcast

How to ask users for broadcast opt-in

Here is an example of how to ask users to opt-in to receive broadcasts.

Ask user a question in your welcome message, and save the answer to a user attribute. You can do it by using either
“Quick Reply” or “Set up user attribute” plugin:

Chatfuel_dashboard

If your bot has already been launched and has an audience, you may need to send them a broadcast with the same question.

Then, when setting up a broadcast, click the User Filter button to open user filter settings:

Chatfuel_dashboard

Select only those who opted-in:

Chatfuel_dashboard

Now you can send unlimited broadcasts to these users.

 

What is “within 24h window” attribute?

within24h_example

Note that according to Facebook’s Policy, after users interact with your bot, you may only message people / send a broadcast within 24 hours of such interaction (apply within 24h window attribute in user filter).

In addition to that, and until the next interaction, you may send one additional message after this 24 hour period in order to follow up on your conversation.

However, you may send broadcasts at any time to those users who specifically opt-in to receiving such content, as described above.

Broadcasting API

Potential use cases

Main use case: send a custom message to one of the users on a given trigger. For example, in a barbershop bot, send a message to one of the barbers when a visitor wants to book a timeslot. Users on both ends have to to be subscribed to the bot.

Another use case: make personalized broadcasts when you need to send different messages to different individual users.

Description

Although this functionality is an API integration, we want Chatfuel to create additional value. So we have made broadcasting API into a template. Which would be different from the JSON plugin for example.

We made it possible to send any block from the bot’s structure to any user. You are able to set up user attributes during an API call right before sending the block.

However, if you still want to use a pure JSON message, you can add a JSON plugin to the block.

You have API-accepting POST requests with application/json content type:

https://api.chatfuel.com/bots/<bot_id>/users/<user_id>/send?chatfuel_token=<token>&chatfuel_block_id=<block_id>&<user_atrribute_1>=<value1>&<user_atrribute_2>=<value2>&...

or

https://api.chatfuel.com/bots/<bot_id>/users/<user_id>/send?chatfuel_token=<token>&chatfuel_block_name=<block_name>&<user_atrribute_1>=<value1>&<user_atrribute_2>=<value2>&...

Where:

  • <token> – a unique secret token obtained for each bot. You are able to find and reset the token in Settings at any time.
  • <user_id> – {{messenger user id}} attribute that you should get from a JSON plugin call prior to sending a message. {{chatfuel user id}} and {{fb_id}} works either.
  • <bot_id> – id of the bot you want to send from (you can find it in browser’s navigation bar).
  • <block_id> – id of the block you want to send to a user (you can find it in the browser navigation bar).
  • <block_name> – URL-encoded name of the block you want to send to a user.
  • <user_atrribute>=<value> – name and value of a user attribute you want to set up before rendering and sending the block.

Chatfuel_dashboard

All params starting with “chatfuel_” are reserved.

You can put params either in the body or the URL.

Here is a booking example

Block content:
Text card:
Hi {{first name}}, {{booking_user}} wants to book a timeslot {{timeslot}}.
Buttons:
Confirm -> confirm booking block
Decline -> decline booking block

API call:
curl -H 'Content-Type: application/json' -X POST -d '{"booking_user":"Daniel Kahneman"}' 'https://api.chatfuel.com/bots/<bot_id>/users/<user_id>/send?chatfuel_token=<token>&chatfuel_block_id=<block_id>&timeslot=12:00+25+Jan+2017&...'

You can pass a user attribute in POST data or GET parameters.

Limitations: no more than 1 request per second, per bot.