Skip to content

TwilioIncomingMessagePayload

Defined in: lib/webhook/twilio-webhook.payloads.ts:179

Body of Twilio’s request when a message arrives at one of your numbers.

@Post('webhooks/sms')
@TwilioWebhook()
@UseInterceptors(TwimlInterceptor)
handleSms(@Body() payload: TwilioIncomingMessagePayload) {
const reply = new twilio.twiml.MessagingResponse();
reply.message(`Thanks, ${payload.ProfileName ?? payload.From}`);
return reply;
}

https://www.twilio.com/docs/messaging/guides/webhook-request

[mediaUrl: `MediaUrl${number}`]: string | undefined
[mediaContentType: `MediaContentType${number}`]: string | undefined
Property Modifier Type Description Inherited from Defined in
AccountSid readonly string SID of the account that received the message. Starts with AC. - lib/webhook/twilio-webhook.payloads.ts:189
Address? readonly string - TwilioLocationParams.Address lib/webhook/twilio-webhook.payloads.ts:158
Body readonly string Message text, up to 1600 characters. - lib/webhook/twilio-webhook.payloads.ts:195
ButtonPayload? readonly string Postback payload identifying which button was pressed. TwilioRichMessageParams.ButtonPayload lib/webhook/twilio-webhook.payloads.ts:139
ButtonText? readonly string Visible label of the pressed button, e.g. 'Cancel Appointment'. TwilioRichMessageParams.ButtonText lib/webhook/twilio-webhook.payloads.ts:141
ButtonType? readonly string Button category: 'REPLY' or 'ACTION'. TwilioRichMessageParams.ButtonType lib/webhook/twilio-webhook.payloads.ts:143
ChannelMetadata? readonly string Stringified JSON: the full response from the rich-messaging channel. TwilioRichMessageParams.ChannelMetadata lib/webhook/twilio-webhook.payloads.ts:149
FlowData? readonly string Stringified JSON payload returned after a WhatsApp flow completes. TwilioRichMessageParams.FlowData lib/webhook/twilio-webhook.payloads.ts:147
Forwarded? readonly string 'true' when the message has been forwarded once. TwilioWhatsAppParams.Forwarded lib/webhook/twilio-webhook.payloads.ts:121
FrequentlyForwarded? readonly string 'true' when the message has been forwarded many times. TwilioWhatsAppParams.FrequentlyForwarded lib/webhook/twilio-webhook.payloads.ts:123
From readonly string Sender’s phone number or channel address. - lib/webhook/twilio-webhook.payloads.ts:191
FromCity? readonly string - TwilioGeoParams.FromCity lib/webhook/twilio-webhook.payloads.ts:76
FromCountry? readonly string - TwilioGeoParams.FromCountry lib/webhook/twilio-webhook.payloads.ts:79
FromState? readonly string - TwilioGeoParams.FromState lib/webhook/twilio-webhook.payloads.ts:77
FromZip? readonly string - TwilioGeoParams.FromZip lib/webhook/twilio-webhook.payloads.ts:78
InteractiveData? readonly string Stringified JSON holding an omnichannel rich-feature response. TwilioRichMessageParams.InteractiveData lib/webhook/twilio-webhook.payloads.ts:145
Label? readonly string - TwilioLocationParams.Label lib/webhook/twilio-webhook.payloads.ts:159
Latitude? readonly string - TwilioLocationParams.Latitude lib/webhook/twilio-webhook.payloads.ts:156
Longitude? readonly string - TwilioLocationParams.Longitude lib/webhook/twilio-webhook.payloads.ts:157
MessageSid readonly string 34-character unique identifier for the message, prefixed SM or MM. - lib/webhook/twilio-webhook.payloads.ts:187
MessagingServiceSid? readonly string SID of the Messaging Service involved, if any. Starts with MG. - lib/webhook/twilio-webhook.payloads.ts:199
NumMedia? readonly string How many media items are attached. A string, e.g. '2'. TwilioMediaParams.NumMedia lib/webhook/twilio-webhook.payloads.ts:105
NumSegments? readonly string Number of message segments, as a string. Always '1' off SMS/MMS. - lib/webhook/twilio-webhook.payloads.ts:197
OriginalRepliedMessageSender? readonly string Sender of the message this one replies to, within the last 7 days. TwilioWhatsAppParams.OriginalRepliedMessageSender lib/webhook/twilio-webhook.payloads.ts:125
OriginalRepliedMessageSid? readonly string SID of the message this one replies to, within the last 7 days. TwilioWhatsAppParams.OriginalRepliedMessageSid lib/webhook/twilio-webhook.payloads.ts:127
ProfileName? readonly string The sender’s WhatsApp profile name, e.g. 'Perspective Coffee'. TwilioWhatsAppParams.ProfileName lib/webhook/twilio-webhook.payloads.ts:117
SmsMessageSid? readonly string :::caution[Deprecated] Identical to MessageSid; kept for compatibility. ::: - lib/webhook/twilio-webhook.payloads.ts:203
SmsSid? readonly string :::caution[Deprecated] Identical to MessageSid; kept for compatibility. ::: - lib/webhook/twilio-webhook.payloads.ts:201
To readonly string Recipient’s phone number or channel address. - lib/webhook/twilio-webhook.payloads.ts:193
ToCity? readonly string - TwilioGeoParams.ToCity lib/webhook/twilio-webhook.payloads.ts:80
ToCountry? readonly string - TwilioGeoParams.ToCountry lib/webhook/twilio-webhook.payloads.ts:83
ToState? readonly string - TwilioGeoParams.ToState lib/webhook/twilio-webhook.payloads.ts:81
ToZip? readonly string - TwilioGeoParams.ToZip lib/webhook/twilio-webhook.payloads.ts:82
WaId? readonly string The sender’s WhatsApp ID, typically a phone number without the +. TwilioWhatsAppParams.WaId lib/webhook/twilio-webhook.payloads.ts:119