Help with Webhooks

Hi all,

I am trying to get webhooks working (not IFTTT webhooks) for use with my Flic buttons as they can send webhooks, but I am not having much luck.
I am trying to run the following:

- alias: 'Disarm with Flic'
  id: 80830b6e-2732-4a79-8620-ec4fb603caa8
  trigger:
    platform: webhook
    webhook_id: 7a6fd82d2bf6432c80061680e4c7deb1
    
  condition:
    - condition: state
      entity_id: group.family
      state: 'home'
    - condition: state
      entity_id: alarm_control_panel.aarlo_s_a_r_a_h
      state: 'armed_away'

  action:
    - service: alarm_control_panel.alarm_home
      entity_id: alarm_control_panel.aarlo_house
    - service: notify.notify
      data:
        title: "House"
        message: "Alarm Stayed with Flic."

I have the following on the Flic configuration:

Type: POST
URL: Give yourself a better website » MY DOMAIN
Headers: blank (should they be?)
Body: { “action”: “trigger” }
Content-Type: x-www-form-urlencoded
Timeout: 10
I’ve turned off Validating certifcates

The button is firing, but not seeing any end result in HA. I’ve followed the documentation but I am at a loss.Though I admit I do not know where the files this section is talking about is:

The payload is available in an automation template as either trigger.json or trigger.data

Any help would be really appreciated :slight_smile:

Content-Type is a header, so I don’t think it matters that Headers are blank.

I notice you’re mixing types though. You’re sending JSON as your body, but you are telling HA that it is receiving x-www-form-urlencoded. Try set Content-Type to application/json and try again.

Also, whenever you deal with APIs, it’s highly recommended to break the problem into the receiving and sending side. Having separate systems play nice can be a real pain.

As mentioned in the guide you posted, run:

curl -d "" https://my-domain.com/api/webhook/7a6fd82d2bf6432c80061680e4c7deb1

And see if your webhook trigger works.

I assume that’s for you to use in your action mate. You can extract the body you are sending:

{ “action”: “trigger” }

I’ve run the curl command, and nothing, I dont get any errors in curl, minus the SSL errors which I disabled.
But nothing happens in Home Assistant, the trigger just doesn’t seem to fire.

I’ve also tried in Postman, and get a 200 Ok response, but nothing in HA.

Scrub that, its working, seems to just lag with the notifications coming through.

So the entire flow is working or just the curl request?

Entire flow appears to be working, I did also turn on the API, so not sure if that has made a difference?!

1 Like