Send an MMS Group Message
In this code snippet you will see how to send an MMS group message using the Messages API.
IMPORTANT: Only US short codes, 10DLC numbers and SMS Enabled Toll Free Numbers are currently supported for sending MMS. For US short codes, MMS messages can be sent to AT&T, T-Mobile (previously Sprint), and Verizon networks in the US. Find out more about setting up 10DLC numbers (note: this page references the SMS API, but the contents of the 10 DLC guidelines section also apply to the Messages API).
Message throughput, deliverability, and SMS message volumes may vary depending on the type of number used. For more information on this, and on MMS in general, see the Vonage MMS overview page, the Vonage 10DLC overview page, and the Vonage Phone Numbers overview page.
Example
Find the description for all variables used in each code snippet below:
| Key | Description |
|---|---|
MESSAGES_API_URL | There are two versions of the API, each with their own endpoints. For production the previous Messages API endpoint was |
MESSAGES_TO_NUMBER | The number you are sending the to in E.164 format. For example |
MMS_SENDER_ID | The alphanumeric string that represents the name or number of the organization sending the message. |
SECOND_MESSAGES_TO_NUMBER | The phone number of the second recipient. |
NOTE: Don't use a leading + or 00 when entering a phone number, start with the country code, for example 14155550105.
Prerequisites
If you do not have an application you can create one. Make sure you also configure your webhooks.
Write the code
Add the following to send-mms-group-message.sh:
curl -X POST "${MESSAGES_API_URL}" \
-H "Authorization: Bearer "$JWT\
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d $'{
"to": "'${MESSAGES_TO_NUMBER}'",
"from": "'${MMS_SENDER_ID}'",
"channel": "mms",
"message_type": "text",
"text": "This is an MMS group message sent via the Vonage Messages API.",
"mms": {
"participants": [
'${SECOND_MESSAGES_TO_NUMBER}'
]
}
}'
curl -X POST "${MESSAGES_API_URL}" \
-H "Authorization: Bearer "$JWT\
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d $'{
"to": "'${SECOND_MESSAGES_TO_NUMBER}'",
"from": "'${MMS_SENDER_ID}'",
"channel": "mms",
"message_type": "text",
"text": "This is an MMS group message sent via the Vonage Messages API.",
"mms": {
"participants": [
'${MESSAGES_TO_NUMBER}'
]
}
}'Run your code
Save this file to your machine and run it:
Try it out
When you run the code an MMS group message is sent to both participants in the group.