'What is the long Twilio URL to initiate an SMS to send?

I want to test Twilio in my Terminal app by cut / pasting the long URL into terminal. This would contain all the ingrediants Twilio receives to send out a message.

I know it start with https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/ but I can't figure out the syntax of the last part. Does anyone have an example full URL?

like this: https://api.twilio.com/2010-04-01/Accounts/SID1234/AUTH6789.html?from=18005551212&to=1212333444&message=Youre order is ready.

I know this isn't secure and I should go through the required library install, then call those. It's just for my testing. Thank you



Solution 1:[1]

When you send an SMS using the Twilio API, you need to make a POST request to the URL, with the data as the body of the request. So the URL is: https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages.json and you can send options like the From number, the To number, and the Body as form encoded parameters in the body of the request. Don't forget you also need to send your account sid and auth token to authorize the request too.

If you are using curl, that would look like this:

curl -X POST https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages.json \
  --data-urlencode "From=YOUR_TWILIO_NUMBER" \
  --data-urlencode "Body=Hi there" \
  --data-urlencode "To=THE_NUMBER_TO_MESSAGE" \
  -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

Solution 2:[2]

You can't call URLs in order to send SMS via HTTP using Twilio. They do not provide an HTTP API. For that, you can use ClickSend using the following URL format: https://api-mapper.clicksend.com/http/v2/send.php?method=http&username=xxxx&key=xxxx&to=xxxx&message=xxxx&senderid=xxxx

, where:

  • username = your site's username;
  • key = API Key;
  • to = recipient no.;
  • message = message body;
  • senderid = the "From" name/number.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 philnash
Solution 2 Alex M