Twilio Messaging API

Twilio Programmable Messaging API is roughly equivalent to Zipwhip’s Commercial API for sending SMS and MMS messages.

SMS

Below are examples of sending an SMS message with the Zipwhip API vs the Twilio API.

Zipwhip API - Send SMS

To send an SMS with the Zipwhip API you must provide the following parameters:

# Zipwhip send SMS
curl -X POST \
"https://api.zipwhip.com/message/send" \
-d "session=$ZIPWHIP_SESSION_KEY" \
-d "contacts=$MOBILE_PHONE_NUMBER" \
-d "body=Hello from Zipwhip API"

Twilio API - Send SMS

To send an SMS with the Twilio API, you must provide the following parameters:

# Twilio send SMS
curl -X POST \
"https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages" \
-u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN" \
-d "From=$TWILIO_PHONE_NUMBER" \
-d "To=$MOBILE_PHONE_NUMBER" \
-d "Body=Hello from Twilio API"

MMS

Below are examples of sending an MMS message with an attachment with the Zipwhip API and the Twilio API.

Zipwhip API - Send MMS with file attachment

The Zipwhip API offers two methods for sending MMS images.

The first method, below, enables you to send an MMS with an attached image in one request.

# Zipwhip send MMS with File Attachment
curl -X POST \
"https://api.zipwhip.com/messaging/send" \
-H "Content-Type: multipart/form-data" \
-F "session=$ZIPWHIP_SESSION_KEY" \
-F "to=$MOBILE_PHONE_NUMBER" \
-F "file=@owl.png;type=image/png"

Zipwhip API- Send MMS with file reference

The alternate method, below, requires an image to be uploaded first, and then referencing the uploaded file when sending a subsequent MMS message. This method is much more efficient when sending the same image to muliple recipients, because you upload the image only once and can reference it multiple times after that.

# Zipwhip upload an attachment
curl -X POST \
"https://api.zipwhip.com/hostedContent/save" \
-H "Content-Type: multipart/form-data" \
-F "session=$ZIPWHIP_SESSION_KEY" \
-F "image=@owl.png;type=image/png"

# Zipwhip send MMS with reference to attachment key
curl -X POST \
"https://api.zipwhip.com/messaging/send" \
-d "key=a9940ddb-f7d0-4aac-8667-ed98a1ce7a07" \
-d "session=$ZIPWHIP_SESSION_KEY" \
-d "to=$MOBILE_PHONE_NUMBER"

Twilio API - Send MMS with file reference

The Twilio Send MMS API is similar to the second Zipwhip Send MMS API example above, where you must first upload a file and then reference the uploaded file in your API request to send the MMS Message.

# Twilio send MMS with MediaUrl
curl -X POST \
"https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages" \
-u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN" \
-d "From=$TWILIO_PHONE_NUMBER" \
-d "To=$MOBILE_PHONE_NUMBER" \
-d "Body=Hello from Twilio API" \
-d "MediaUrl=https://demo.twilio.com/owl.png"

Note: The uploaded file must be hosted on a publicly accessible URL. If you’re not already using a file hosting service like S3, you can use Twilio Assets as your static file hosting service for this purpose.