You just need to add the url in the webapi "https://ACCOUNT SID:AUTH TOKEN@api.twilio.com/2010-04-01/Accounts/SERVICE ID/Messages.json
Thank you @abdallask
I gave all above recommendations and this confirms that my suggestions in the other post should be workable.
However, can I ask you to confirm that the Header
in the Web API
setup shows
Content-Type= application/x-www-form-urlencoded
Many thanks in advance.
I don’t have any Header setup, it works without it I guess.
maybe because of this it’s not stable? It works most of the time but not everytime!
Many thanks for your confirmation.
If you don’t have Content-Type in the header it will default to text/plain
which as you experienced will not be stable.
[Edit]
Another thing I noted. You are checking the status
to be 201. In fact all 200 range is good not only 201 specifically.
List of codes for API requests
Hi @abdallask and @muneer,
This is now my working Blocks.
I read an article about postman.com, I used the curl statement Twilio provided, put them each in their corresponding places. The most important thing is in the Authorization Tab, I selected Basic Auth and typed my $TWILIO_ACCOUNT_SID in the Username Entry and $TWILIO_AUTH_TOKEN in the Password Entry. After that, I opened the Headers Tab including the Hidden Auto-generated Headers, I saw the base64 encoded Authorization. This is in the form of Basic set-of-random-characters different from the $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN. This is what @muneer is referring about encrypted $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN. I copied that and placed it in my Headers in Thunkable along side with my current Content-Type:application/x-www-form-urlencoded
There is no need to use %2B or %20 for the Body, From and To in the Body Block. It has a 201 status and the SMS is sent to the Phone Number stored in my variable. Phone number formats should follow the format below:
Thank you all.
So I concluded from above that you were getting 401 because the set-of-random-characters were not the correct one. Once generated by Postman and you used it in the app it worked.