Namespace: messaging

Interfaces

Functions

postMultimedia

postMultimedia(messaging_type, psid, multimedia, quickReplies?): Promise<void>

Send a multimedia message to FB Messenger. https://developers.facebook.com/docs/messenger-platform/send-messages#sending_attachments

Parameters

Name Type Description
messaging_type "RESPONSE" | "UPDATE" | "MESSAGE_TAG" | "NON_PROMOTIONAL_SUBSCRIPTION" type of message: ‘RESPONSE’ or ‘UPDATE’
psid string psid of the user
multimedia Multimedia url of ‘audio’ | ‘file’ | ‘image’ | ‘video’
quickReplies? QuickReply[] Prefilled quick reply “buttons” for the user

Returns

Promise<void>


postTemplate

postTemplate(messaging_type, psid, template): Promise<void>

Send a template message to FB Messenger. https://developers.facebook.com/docs/messenger-platform/send-messages/templates

Parameters

Name Type Description
messaging_type "RESPONSE" | "UPDATE" | "MESSAGE_TAG" | "NON_PROMOTIONAL_SUBSCRIPTION" type of message: ‘RESPONSE’ or ‘UPDATE’
psid string psid of the user
template ButtonTemplate | ListTemplate | GenericTemplate The body of the message in Generic Template, List Template, etc format

Returns

Promise<void>


postText

postText(messaging_type, psid, text, quickReplies?): Promise<void>

Send a plain text message to FB Messenger. https://developers.facebook.com/docs/messenger-platform/send-messages#sending_text

Parameters

Name Type Description
messaging_type "RESPONSE" | "UPDATE" | "MESSAGE_TAG" | "NON_PROMOTIONAL_SUBSCRIPTION" type of message: ‘RESPONSE’ or ‘UPDATE’
psid string psid of the user
text string -
quickReplies? QuickReply[] Prefilled quick reply “buttons” for the user

Returns

Promise<void>


senderAction

senderAction(psid, action): Promise<void>

Actions to fake userlike behaviour for the bot. https://developers.facebook.com/docs/messenger-platform/send-messages/sender-actions

Parameters

Name Type Description
psid string psid of the user
action "mark_seen" | "typing_on" | "typing off" the sender action to take

Returns

Promise<void>