How can you send an SMS message using pure HTTP post with no other libraries

Walter D

I know you can use HTTP POST passing in 'from', 'to' and 'body' as http parameters. But how can you send 'account sid' and 'auth token'? Can you use a request header or something? I would like to post without using PHP or Curl or any other libraries.

Thanks

Devin Rader

Twilio evangelist here.

As you mention to make a raw request to the Twilio REST API without a helper library you need to craft your own HTTP request. The specific HTTP Method you use for the request (GET,POST,PUT,DELETE) depends on what you want the API to do.

Twilio uses simple Basic authorization to authorize users of the API. To use Basic Authentication with HTTP you need to include in your HTTP request the Authorization header and pass as its value the authorization scheme (in Twilio case this is "Basic") and a Base64 encoded string containing your accountsid and authtoken seperated by a semi-colon:

[AccountSid]:[AuthToken]   

The HTTP header would end up looking something like this:

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

For example of you wanted to have Twilio send a text message you would craft an HTTP request using the POST method that looks like this:

POST https://api.twilio.com/2010-04-01/Accounts/[YOUR_ACCOUNT_SID]/Messages HTTP/1.1
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Host: api.twilio.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 50

To=+15555555555&From=+16666666666&Body=Hello World

Hope that helps.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Send HTTP POST message in ASP.NET Core using HttpClient PostAsJsonAsync

From Java

Flutter - How to send a POST request using HTTP in Dart?

From Dev

Send SMS message using non default SMS app on Android 4.4

From Dev

How can I send a File via HTTP POST along with my other text parameters?

From Dev

How do you send a message using pyOSC?

From Dev

Can't send POST message over Https

From Dev

Send json object using POST pure javascript

From Dev

How i can Send Auto sms in swift?

From Dev

Twilio - Send HTTP Request to Endpoint When SMS Message is Received

From Dev

Firebase Notifications: Send Message Through HTTP Post

From Dev

How can I send HTTP broadcast message with tornado?

From Dev

How do you send message using NFC with Xamarin.Android?

From Dev

How to send/receive a chat message using JAXL libraries (XMPP technology, PHP, Openfire server)

From Dev

Unity send SMS message

From Dev

How to send POST with body, headers, and HTTP params using cURL?

From Dev

Can you send sub-sequential HTTP POST request to a sever

From Dev

How can I send a File via HTTP POST along with my other text parameters?

From Dev

Post request for SMS message?

From Dev

POST (HTTP) + jQuery: How can I send specific form data?

From Dev

How can you send an SMS message using pure HTTP post with no other libraries

From Dev

How to send FormData In Http Post using Spray

From Dev

Can't send POST message over Https

From Dev

Send json object using POST pure javascript

From Dev

How i can Send Auto sms in swift?

From Dev

How to send an HTTP POST Request to Opbeat using Java?

From Dev

Twilio - Send HTTP Request to Endpoint When SMS Message is Received

From Dev

How to send Password Protect SMS/Text Message

From Dev

Using AJAX to call Node.js file to send SMS message

From Dev

How can send sms by url codeigntor

Related Related

  1. 1

    Send HTTP POST message in ASP.NET Core using HttpClient PostAsJsonAsync

  2. 2

    Flutter - How to send a POST request using HTTP in Dart?

  3. 3

    Send SMS message using non default SMS app on Android 4.4

  4. 4

    How can I send a File via HTTP POST along with my other text parameters?

  5. 5

    How do you send a message using pyOSC?

  6. 6

    Can't send POST message over Https

  7. 7

    Send json object using POST pure javascript

  8. 8

    How i can Send Auto sms in swift?

  9. 9

    Twilio - Send HTTP Request to Endpoint When SMS Message is Received

  10. 10

    Firebase Notifications: Send Message Through HTTP Post

  11. 11

    How can I send HTTP broadcast message with tornado?

  12. 12

    How do you send message using NFC with Xamarin.Android?

  13. 13

    How to send/receive a chat message using JAXL libraries (XMPP technology, PHP, Openfire server)

  14. 14

    Unity send SMS message

  15. 15

    How to send POST with body, headers, and HTTP params using cURL?

  16. 16

    Can you send sub-sequential HTTP POST request to a sever

  17. 17

    How can I send a File via HTTP POST along with my other text parameters?

  18. 18

    Post request for SMS message?

  19. 19

    POST (HTTP) + jQuery: How can I send specific form data?

  20. 20

    How can you send an SMS message using pure HTTP post with no other libraries

  21. 21

    How to send FormData In Http Post using Spray

  22. 22

    Can't send POST message over Https

  23. 23

    Send json object using POST pure javascript

  24. 24

    How i can Send Auto sms in swift?

  25. 25

    How to send an HTTP POST Request to Opbeat using Java?

  26. 26

    Twilio - Send HTTP Request to Endpoint When SMS Message is Received

  27. 27

    How to send Password Protect SMS/Text Message

  28. 28

    Using AJAX to call Node.js file to send SMS message

  29. 29

    How can send sms by url codeigntor

HotTag

Archive