2

I'm using postman to see the response format of send message api in Twilio. The Api that I'm using is https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages. I have entered the basic authentication parameters (Account_Sid and AuthToken as username and password) the json request format is

{
"To":"My Number",
"From":"Twilio Number",
"Body":"Hello this msg is from postman"}

But I'm getting error 21603 which states "A 'From 'phone number is required". Can you please tell me where I'm wrong. The messages are sent when using Twilio console.

Janmajay
  • 49
  • 1
  • 9
  • Possible duplicate of [Getting "A From phone number is required" in JSON call to Twilio](https://stackoverflow.com/questions/33764125/getting-a-from-phone-number-is-required-in-json-call-to-twilio) – Hassan Imam Jul 07 '18 at 10:31
  • Not really @HassanImam that didn't helped – Janmajay Jul 07 '18 at 10:35

1 Answers1

2

I can't see your Postman but, maybe this is what you're missing...

Click on the Body tab and make sure form-data is selected from the radio buttons.

enter image description here


Also if you go to Twilio docs page (https://www.twilio.com/docs/sms/send-messages) you can see the expected response if you click on the OUTPUT link (tab) that is located at the top right of the code sample.

enter image description here

Alex Baban
  • 11,312
  • 4
  • 30
  • 44
  • Hi Alex Baban,Thanks for the reply. I was able to get the json response but the problem is I'm not able to send the request as json. Is form-data or x-www-form-urlencoded the only way to send a request to Twilio Rest messaging api? – Janmajay Jul 08 '18 at 07:25
  • You're welcome, glad it helped. As far as I know, you're correct, form-data or x-www-form-urlencoded is the only way to send a request to send a message with Postman. – Alex Baban Jul 08 '18 at 14:26