Twilio Inbound Webhook Configuration

Hello,

I am having an issue with Twilio inbound webhook configuration. When I text the number it reaches out to the webhook url given to me by the Twilio integration UI.

In the Twilio Debugger -> POST -> Request -> Message Text

Msg: "Invalid Content-Type: application/octet-stream supplied"
sourceComponent: "14100"
ErrorCode: "12300"
EmailNotification: "false"
contentType: "application/octet-stream"
LogLevel: "ERROR"

In the Twilio Integration UI(in Home Assistant), it says I should configure the content type to be “application/x-www-form-urlenconded”, but I can’t find that setting in Twilio or Home Assistant.

Have you made any progress on this?

I can select the webhook service if I go to Twilio - Menu - Phone Numbers -

select the number you’d like, then scroll down and change the configuration from “messaging service” to webhook…

It doesn’t specifically say URL encoded, but I think this is the option you want. I used that setting for inbound to a service called “Textable”. That worked well until my sms volume began to big down their load times.

I got the same issue. Still looking for a solution.

I ran into this too, but at least for me it doesn’t seem to actually impact the ability to consume the inbound events in Home Assistant, since it does successfully call the webhook. If you go into the Developer Tools > Events UI in Home Assistant and listen to the “twilio_data_received” event, then send a SMS, you will see the inbound text message trigger an event there.

It seems like more of an annoyance from the Twilio side, since it registers there as an error even though it did succeed.

Using justjohn’s steps, I can see the event too. I can’t recall if I could see it before or not. What is interesting is that I can’t see the “configure” option on the Twilio integration page. I tried upgrading my supervisor, but that didn’t help. I am pretty sure it used to be there.

Even though I get the error log on the Twilio side, the sms are hitting my webhook as intended.

Twilio HTTP Post Webhook URL

http://yourdomain.duckdns.org/api/webhook/new_sms

My configuration.yaml

twilio:
  account_sid: 123456789abcdefghijklmnopqrstuvwxyz
  auth_token: 123456789abcdefghijklmnopqrstuvwxyz 

My automations.yaml

- alias: Test
  trigger:
    platform: webhook
    webhook_id: new_sms
  action:
    service: persistent_notification.create
    data:
      message: '{{ trigger.data.Body }}'
      title: New SMS

When I send a SMS to my Twilio phone number my HA dashboard notification panel gets a text message and passes the body of the SMS to the notification body. Pretty cool. From this point on you could parse the SMS and have HA do whatever you want. I plan on writing up a more detailed tutorial on this setup.

Troubleshooting:
I do believe I installed the Twilio integrating and reinstalled it to get it to work and of course rebooting your server always helps

If anyone is looking to get this working with the Nabu Casa webhook the automation I’m using looks like this:

- alias: Notify Twilio
  trigger:
    platform: event
    event_type: twilio_data_received
  action:
  - service: persistent_notification.create
    data_template:
      message: '{{ trigger.event.data.Body }}'
      title: New Notify from Text Message

Note the '{{ trigger.event.data.Body }}' is what grabs the message.

1 Like

I proposed a fix at https://github.com/home-assistant/core/pull/66561.

1 Like