Webhook to Twilio SMS gives error 404

My Photon app has been successfully publishing, among others a text variable ‘status’ to the Particle cloud. So I now wanted to try out a webhook for the first time, to see if I could use Twilio to SMS the ‘status’ to a phone. I registered and got a Twilio phone# and thought I was able to follow the webhook setup directions. But after I created the webhook, I tried the ‘Test’ button and got error 404.

This is everything I could find regarding my webhook setup, as well as the log data which recorded the error.
Sorry about the lousy formatting, It looked perfectly fine in the edit window before I saved it. Something must be confusing the edit program.

Event: twilio_smsB     Target: twilio.com
ID: 5C********************c0  Created: February 13th, 2019

Integration Info

Event Name     twilio_smsB

Full URL https://api.twilio.com/2010-04-01/Accounts/{{AC******************************c1}}/Messages

Event Type   		POST
				
Request Format		 Web Form  
		{
		"To": 	"[[+18*******99]]", 	
Form  	"From":	"[[+19*******55]]",
   		"Body": "{{PARTICLE_EVENT_VALUE}}"
		}
		{
		"username": "[[AC******************************c1]]",
Auth	"password": "[[0a****************************ed]]"
		}

		{
Headers	"Content-Type": "application/x-www-form-urlencoded"
		}

Enforce SSL		Yes


As used in my Particle .ino file:
		Particle.publish("twilio_smsB", String(status), PRIVATE);


History
Logs

Error Message
	error status 404 from api.twilio.com

Event

{
  "name": "twilio_smsB",
  "data": "test-event",
  "ttl": 60,
  "published_at": "2019-02-13T14:30:23.201Z",
  "coreid": "api"
}

Request

POST /2010-04-01/Accounts//Messages HTTP/1.1
User-Agent: ParticleBot/1.1 (https://docs.particle.io/webhooks)
host: api.twilio.com
content-type: application/x-www-form-urlencoded
authorization: Basic W1**************************1d
content-length: 77
Connection: keep-alive

Response
HTTP/1.1 404 NOT FOUND
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since
Access-Control-Allow-Methods: GET, POST, DELETE, OPTIONS
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag
Content-Type: application/xml
Date: Wed, 13 Feb 2019 14:31:23 GMT
Strict-Transport-Security: max-age=31536000
Twilio-Request-Duration: 0.002
Twilio-Request-Id: RQ******************************54
X-Powered-By: AT-5000
X-Shenanigans: none
Content-Length: 288
Connection: keep-alive

<?xml version='1.0' encoding='UTF-8'?>
<TwilioResponse><RestException><Code>20404</Code><Message>The requested resource /2010-04-01/Accounts//Messages was not found


Do you really have your account number in {{ }} in the full URL field? That is most likely not right. That treats it as a mustache template and will replace that string with a value in the data. But since your data is not in JSON format, the field will be empty, which is probably why you have a 404 not found error.

2 Likes

Yes, thanks, that’s what I did. Should I put it in in { } ?

No, it should just be bare with no separators.

I think you will need to remove the square brackets in the To, From, Body, username, and password as well.

2 Likes

Thanks, that did it. Now working perfectly.

I think I still want to have Body the way it was.
"{{PARTICLE_EVENT_VALUE}}"
The rest should be bare as you suggested.

Sorry, yes you should leave the Body with the {{PARTICLE_EVENT_VALUE}}