The sender actions message property allows you to control indicators for typing and read receipts in the conversation via the Send API. This is helpful for letting message recipients known you have seen and are processing their message.
To display a sender action in the conversation, send a POST
request to the Messenger Platform with the sender_action
property:
curl -X POST -H "Content-Type: application/json" -d '{
"recipient":{
"id":"<PSID>"
},
"sender_action":"typing_on"
}' "https://graph.facebook.com/v2.6/me/messages?access_token=<PAGE_ACCESS_TOKEN>"
Note that the request should only include sender_action
and the recipient
object. All other Send API properties, such as text and templates, should be sent in a separate request.
For a complete list of API calls and request properties, see the Send API Reference.
The following sender actions are supported. Typing indicators are automatically turned off after 20 seconds, or when the bot sends a message.
Sender Action | Description |
---|---|
| Mark last message as read |
| Turn typing indicators on |
| Turn typing indicators off |
When batching Graph API requests, do not include typing_on
and typing_off
sender actions in the same batch. This will likely result in the typing_on
indicator being displayed for fractions of a second, since batched requests are executed in order very quickly.
Do not allow an unnatural amount of time (too long or too short) to pass between typing_on
and typing_off
sender actions. Ideally, the user should feel that a real person was typing the message in the elapsed time.
Send the typing_on
indicator when your bot receives a message it will respond to. This helps create a conversational experience.
Send the mark_seen
indicator when your bot receives a message so that the user doesn't feel ignored.