Skip to content

Messaging Event Handlers

Send Email API

beforeSendEmail

*argument blocks: *

Request Subject - subject line of the email message.

Request BodyParts - a collection of the bodypart objects. For the details on the bodypart structure see the 'Request Body' section of the Send Email API documentation.

Request Recipients - a collection of email addresses where the email will be sent to.

Request Attachments - a collection of file paths (from the Backendless File Storage). The referenced files will be attached to the email message.

afterSendEmail

return value block:

Response Result - a MessageStatus object with the id assigned to the request.


Device Registration API (for Push Notifications)

beforeDeviceRegister

*argument blocks: *

Request DeviceRegistration - a device registration object containing device type, id and token. For the details on the object structure see the Request Body section of the Device Registration API.

afterDeviceRegister

return value block:

None


Subscribe for PubSub Messages API

beforeSubscribe

*argument blocks: *

Request Channel - name of the channel to subscribe to.

Request Options - subscription options object. For additional details see the Request Body section of the Message Subscription API documentation.

afterSubscribe

return value block:

Response SubscriptionId - an ID assigned to the subscription. Can be used to poll for messages or to cancel the subscription.


Publish a Message (used for Pub/Sub and/or Push Notification message delivery)

beforePublish

*argument blocks: *

Request Message - message object or a primitive value to publish.

Request Publish Options - a publish options object. For additional details see the Request Body section of the Message Publish API documentation.

Request Delivery Options - a delivery options object. For additional details see the Request

afterPublish

return value block:

Response PublishStatus - a MessageStatus object containing message ID and message publish status. The ID can be used to retrieve message status.


Poll for Messages (Pub/Sub)

beforePoll

*argument blocks: *

Request SubscriptionId - a subscriptionId identifying the subscription to get any pending pub/sub messages for.

afterPoll

return value block:

Response Messages - a collection of messages returned from the server.


Cancel Published Message

beforeCancel

*argument blocks: *

Request MessageId - ID of a message to cancel.

afterCancel

return value block:

Response MessageStatus - a message status object containing the status of the cancellation operation.