Test TwiML Bins using Postman
Postman Collection availability
Our Postman Collection is temporarily unavailable. We'll restore it as soon as possible.
Postman is an application that you can use either as a standalone application or in your browser to make HTTP requests. You can, for example, use Postman to explore our Twilio APIs, or in this case create an HTTP request to trigger your TwiML Bin.
In order to make a request to your TwiML Bin using Postman, you'll need:
- Have your Account SID and Auth Token available
- Your TwiML Bin Handler — it has the format of
https://handler.twilio.com/twiml/EHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- Generate a valid
X-Twilio-Signature
to pass to your request.
Get started with triggering TwiML Bins from Postman is by using our Twilio Webhook Requests collection.
Once you open the collection hover over the Send button, and you'll be promoted to Create a fork. Click the button to create a new fork (you might be prompted to sign-up or sign-in with Postman).

Afterwards, create the fork by giving it a label, and selecting the workspace in your account that you want the collection to be added to.

After creating a fork, you'll have to create a new Environment in your account by clicking New at the top left and choosing Environment. Once created, you want to give the environment a name, such as "Your Twilio Environment", by pressing the pencil icon next to New Environment. Next, you have to add two new Variables:
TWILIO_ACCOUNT_SID
with the Current Value of your Twilio Account SIDTWILIO_AUTH_TOKEN
with the Current Value of your Twilio Auth Token

Afterward, click Save, and select your new environment at the top right in the dropdown reading "No Environment".

You are now ready to make your requests. Open the TwiML Bin Request with Signature request from the left navigation bar, replace the placeholder URL of https://handler.twilio.com/twiml/EHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
with your own TwiML Bin URL, and click Send.

If you are already familiar with Postman, you can use the following code in your Pre-request Script section in Postman:
1const authToken = pm.environment.get('TWILIO_AUTH_TOKEN');23function interpolate (value) {4return value.replace(/{{([^}]+)}}/g, function (match, $1) {5return pm.variables.get($1);6});7}89function crypto(authToken, data) {10let signature = CryptoJS.HmacSHA1(CryptoJS.enc.Utf8.parse(data), authToken);11let base64 = CryptoJS.enc.Base64.stringify(signature);12return base64;13}1415function getSignature(authToken, url, params) {16let data = Object.keys(params).sort().reduce((acc, key) => acc + key + interpolate(params[key]), interpolate(url));17return crypto(authToken, data);18}1920pm.environment.set('TWILIO_SIGNATURE', getSignature(authToken, request.url, request.data));
Afterwards, make sure to:
- Create a Postman environment with the
TWILIO_ACCOUNT_SID
andTWILIO_AUTH_TOKEN
variables defined. - Change the
Body
configuration to contain anAccountSid
Key with the Value{{TWILIO_ACCOUNT_SID}}
. - Change the
Headers
configuration to include a Key ofX-Twilio-Signature
with the Value{{TWILIO_SIGNATURE}}
.
This will ensure that a valid X-Twilio-Signature
is automatically generated and inserted into your request headers.