Control Your Messaging Costs by Setting a Maximum Price

August 26, 2015
Written by

MaxPrice

When customers expand internationally, we often hear the question “How do I avoid routes that may be much more expensive than the ones I’ve used in the past?” The reality is that not all messages cost the same amount to send, and sometimes businesses prefer not to send or receive messages when the cost surpasses a certain price.

To address this, we’ve added a new feature that will allow Twilio SMS users to better control high costs by setting a maximum price for messages. This added cost control will help you avoid high or unpredictable costs that can surface when sending messages in new areas.

How it Works

This new feature enables you to set a maximum price to apply to all messages. Once you set that limit, we will not send messages that exceed your set price.

When parameter MaxPrice is used, Twilio will check the price of the message against the amount set in this parameter. ( MaxPrice is the total price of the message —the price of longer messages that consist of several segments would be compared against this price).

If the limit you set is less than the cost of the message Twilio will return a Failed status for the message in the StatusCallback. The initial response will still be 200 with a status of Queued; however, after the price has been calculated the message will return as Failed (Error Code 30010) as part of the status callback if the price exceeds your limit.

For outbound messages, the final price of the message is returned as a POST to the Status Callback URL. This POST request is made as soon as the price is available and may be a separate webhook from Status parameter updates.

Get Started

Adding MaxPrice is straightforward. Here’s an example of a price set at $0.50:

-XPOSThttps://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json \
   -d "Body=Jenny%20please%3F%21%20I%20love%20you%20<3" \
   -d "To=%2B15558675309" \
   -d "From=%2B14158141829" \
   -d "MaxPrice =  0.50"
   -d "MediaUrl=http://www.example.com/hearts.png" \