context.payload.data.| Field | Type | Description |
|---|---|---|
notifiable | string[] | One or more recipients — phone numbers for SMS/WhatsApp, email addresses for Email |
type | string | Why this message is being sent (e.g. order.status.updated, auth.otp.verification) |
content | string | The ready-to-send message body — use this as-is or reformat it for your provider |
entity | object | null | The related store entity (order, shipment, product, etc.) — can be null, always check before accessing |
meta | object | Additional context such as customer_id or OTP code |
communication.whatsapp.send payload looks like when an order status changes:{
"event": "communication.whatsapp.send",
"data": {
"notifiable": ["+966500000000"],
"type": "order.status.updated",
"content": "Your order #1234 status has been updated to: Shipped.",
"entity": {
"id": 1234,
"type": "order"
},
"meta": {
"customer_id": 987
}
}
}entity and metanull or missing depending on the event type. Accessing them without a null check is the most common cause of a 500 error. Use optional chaining (entity?.id) in your handler.context.settings.twilio_account_sid etc. before publishing.notifiable array Salla sent. If it is not, log it and return a success early — this is not an error, just a message that was not meant for this customer.entity. This can be null depending on the event, so always guard it. If there is no order entity, log it and return early.data.content. The data.content field is the ready-to-send body Salla prepared — use it as a fallback or as the primary message depending on your needs. Format the recipient number with the whatsapp: prefix that Twilio requires.500 with the error message so it appears in the function logs.communication.whatsapp.send