API Endpoint
Arguments
| src string Required — Conditional | The sender ID you want to use, which may be a phone number, a short code, or an alphanumeric string. For a WhatsApp message, use the phone number associated with your WhatsApp Business Account and mapped to your Plivo account. You may use either src or powerpack_uuid but not both. If you’re sending a message toward India and are registered on a DLT portal, use the registered DLT header that’s mapped to the template you’re sending. All characters other than A-Z, a-z, and 0-9 are stripped off automatically as part of the sanitization process. Sanitized phone numbers must begin with the international country code (for example, 14152828726), and should be <= 14 characters in length. Sanitized alphanumeric sender IDs should be <= 11 characters in length. Support for alphanumeric sender IDs is disabled by default. You must have a Plivo phone number to send messages to the US or Canada. You can buy a Plivo number from Phone Numbers > Buy Numbers on the Plivo console or via the Numbers API. |
| powerpack_uuid string Required — Conditional | Set this to the UUID of the SMS Powerpack you wish to use for this message. You may use either src or powerpack_uuid but not both. |
| dst string Required | The phone number to which the message is to be delivered. The following characters are stripped off automatically as part of the sanitization process: /, -, ., +, (, ), and white spaces. Sanitized phone numbers must begin with the international country code (for example, 14152828726), and should be <= 14 characters in length. To send messages to multiple numbers, separate your destination phone numbers with the delimiter < — for example, 14156667777<14157778888<14158889999. When you send WhatsApp messages to multiple destination numbers in a single request, each destination number will result in a unique conversation and will be tracked separately. |
| text string Required - Conditional | The content of the text message. For SMS Messages containing only GSM 03.38 7-bit characters have a maximum limit of 1,600 characters. Messages longer than 160 characters are split into multiple message units, each unit consisting of 153 characters. Messages containing one or more UCS-2 16-bit Unicode characters have a maximum limit of 737 characters. Messages longer than 70 characters are split into multiple message units, each unit consisting of 67 characters. Multiunit messages are automatically stitched back together and delivered as a single message in countries where mobile networks support long message concatenation. For WhatsApp messages You can send messages with this field when sending freeform messages. Non-templated messages can only be sent when an active conversation is ongoing. If no conversation is ongoing, such messages will fail with error 340. Use this parameter when you’re sending freeform (non-templated) text messages. These messages may be no longer than 4,096 characters. When sent along with media, this text will be displayed in WhatsApp as a media caption. When sent with media, text may be no longer than 1,024 characters. |
| type string | Allowed values: sms for SMS messages, mms for MMS messages, or whatsapp for WhatsApp messages. Defaults to sms. |
| media_urls string Required — Conditional | For MMS messages A comma-separated list of URL-encoded hyperlinks to the images or media to be included in the MMS message. This is a required field if the message type is mms. Up to 10 media files may be included in a single MMS message. Images of type gif, png, and jpeg will be formatted correctly for device compatibility before being forwarded downstream. Plivo may also resize an image if the original attachment exceeds the maximum size supported by the destination network. You may include other media types (audio, video, vcards), but attachments of these types are not optimized for device compatibility. The total size of the MMS must not exceed 5MB. Messages exceeding this limit will be marked as Failed with error code 120. Note that Plivo will attempt to order media attachments on the device in the order specified in the API request, but the ordering cannot be guaranteed. For WhatsApp messages Use only a single media URL per message. Image, video, documents, and audio files are supported. For valid file types and maximum file size accepted refer to Meta documentation. |
| template object Required — Conditional | JSON object to send templated WhatsApp messages when type is whatsapp. Message templates are used to initiate conversations with customers. Templated messages are the only types of message that you can send to customers who have yet to initiate a conversation with you, or who have not sent you a message in an existing conversation thread within the last 24 hours. You can create templates using WhatsApp Manager. Templates are uniquely identified by a combination of template name and language code. Components are used if dynamic variables are sent within a template. Here are the arguments sent in the Template object. |
| interactive object optional | JSON object to send interactive WhatsApp messages when type is whatsapp. Interactive messages are non-templated messages and cannot be sent unless there is an active conversation. Interactive messages include list buttons, reply buttons, click-to-action url buttons. Here are the arguments sent in the Interactive object. |
| location object optional | JSON object to define location attributes when type is whatsapp. Location attributes that can be passed are:
|
| message_expiry string | Set this parameter to control the time your message remains in the messaging queue. Once this period elapses your messages will fail with error code 420. The error code will be relayed back to your message URL, if configured. The value can be between 5 and 10,799 seconds. Defaults to 10,800 seconds (3 hours). |
| url string | Set this parameter to the fully qualified URL to which status update callbacks for the message should be sent. Read more about the message attributes passed to this callback URL. |
| dlt_entity_id string Required — Conditional | The DLT entity ID that was generated during the DLT registration process. Used only by customers with India DLT registrations that have their Plivo accounts configured to support India DLT traffic. For more information see DLT Registration Process for Sending SMS to India. Your message will fail with Plivo error code 160 if you pass this parameter incorrectly. |
| dlt_template_id string Required — Conditional | The DLT template ID that was generated during template creation in DLT portal. Used only by customers that have their Plivo accounts configured to support India DLT traffic. For more information see DLT Registration Process for Sending SMS to India. The template should be associated with the DLT header that’s passed as the src as part of this request. Your message will fail with Plivo error code 160 if you pass this parameter incorrectly. |
| dlt_template_category string Required — Conditional | The DLT template category from the DLT portal. Used only by customers that have their Plivo accounts configured to support India DLT traffic. Incorrect tagging of this parameter might result in message failures due to DND scrubbing. Allowed values: transactional, promotional, service_implicit, service_explicit. |
| method string | The HTTP method to be used when calling the URL defined above. Allowed values: GET, POST. Defaults to POST. |
| trackable boolean | Set this parameter to true for messages that have a trackable user action, such as entering a 2FA verification code. Setting this parameter to true implies that you intend to update Plivo upon successful delivery of the message using the Conversion Feedback API. Defaults to false. |
| log string | Possible values: true, false, content_only, number_only Defaults to true. If set to true, this message’s phone number and content data (text and media) will be logged on Plivo’s infrastructure. If set to false, this message’s phone number and content data (text and media) will not be logged on Plivo’s infrastructure, and the value will be masked (for example, +141XXXXX528). Media URLs will not be logged for MMS messages, and the message’s media sub-resource will return an empty list. If set to content_only, this message’s content data (text and media) will be logged on Plivo’s infrastructure. Phone number data will be masked. If set to number_only, the phone number data of this message will be logged on Plivo’s infrastructure. Content data (text and media) will be masked. The customer agrees and acknowledges that Plivo may need to override this setting and log the content of some messages from time to time to ensure compliance with the applicable local laws or to monitor and debug for service quality. |