Handling incoming SMS/MMS/WhatsApp
Plivo forwards incoming messages to the message_url
configured for the application
associated with the phone number on which the message was received.
Certain values provided in the list of attributes below will be posted to your callback based on the number type (long code, toll-free, or short code) and message type (SMS or MMS). We’ve updated the availability of these attributes under the name attribute.
Note: LC — long code, TF — toll-free, SC — short code
Attributes
MessageUUID SMS,WhatsApp,MMSLC, TF, SC | The unique identifier for the message. |
From SMS,WhatsApp,MMSLC, TF, SC | The source number of the incoming message — the phone number from which the message originated. |
To SMS,WhatsApp,MMSLC, TF, SC | The Plivo number on which the message was received. |
Text SMSLC, TF, SC | The content of the message. Note that Plivo automatically concatenates multipart long messages before forwarding them to your |
Body WhatsApp,MMSLC, TF | The text content (if any) in the multimedia message (MMS). Together, For WhatsApp, any inbound text content (with or without media) will be populated here. |
Type SMS, WhatsApp,MMSLC, TF, SC | Allowed values: |
Units SMS, MMSLC, TF, SC | The number of parts in which the incoming message was received. This is > 1 for multipart long messages. For |
TotalRate SMS,WhatsApp,MMSLC, TF, SC | The charge applicable per incoming message unit. |
TotalAmount SMS,WhatsApp,MMSLC, TF, SC | Total charge for receiving the SMS (TotalRate * number of Units) |
MessageIntent SMSLC, TF | Set to |
PowerpackUUID SMS, MMSLC, TF, SC | The UUID of the Powerpack associated with the |
MediaCount MMSLC, TF | The number of media files attached with this MMS message. |
Media<count> ex: Media1, Media2 ... MMS LC, TF | The URL to a specific media file associated with the MMS message. The integer suffixes range from 1 to the count of media files received. |
ContentType WhatsAppLC, TF | WhatsApp only attribute Specifies the content type of inbound message. Possible values are |
MimeType WhatsAppLC, TF | WhatsApp only attribute Valid for inboundmedia only. Specifies the type of media file. ex: video/mp4 |
ErrorCode WhatsApp,MMSLC, TF | The Plivo error code that identifies the reason for the inbound message delivery failure. This parameter is only defined for “failed” or “undelivered” messages. |
Replying to an incoming message
It is possible to reply to an incoming message by returning a Plivo Message XML element in the response to the incoming request.
Make sure to set the response Content-Type
to application/xml
in this case.