Webhooks from IFTTT - sending custom action and/or variables questions

buckle up, I wanted to be quick, but the post just grew… so here’s kinda long read :wink:

TL;DR: want to send some variables from IFTTT to HomeAssistant, that would feed universal automation/script which is going to do the rest based on variables. for main questions please jump to the end of this post :slight_smile:

I’m using IFTTT webhooks to call few services/scripts on my Home Assistant. even helped few guys so I guess “I’m doing it ok” :wink: but right now I’m stuck with sending more variables thru it.

background info: I love to make universal automations/scripts that can work differently based on given arguments.

so, I want to pimp up the simple webhook receiving automation to be able to handle more case scenarious than the basic one. if you don’t want to jump between topics, here’s the basic one:

- alias: automate_ifttt
    - platform: event
      event_type: ifttt_webhook_received
        action: 'call_service'
    - service_template: '{{ trigger.event.data.service }}'
        entity_id: '{{ trigger.event.data.entity_id }}'

when I POST application/json body from IFTTT, containing:

  "action": "call_service",
  "service": "script.turn_on",
  "entity_id": "script.MY_SCRIPT"

everything works, and script.MY_SCRIPT is being executed.
but I want to pass some info to that script - let’s say it’s going to be the URL to some file uploaded to my Google Drive. so I modify json’s body to:

  "action": "call_service",
  "service": "script.turn_on",
  "entity_id": "script.MY_SCRIPT",
  "variables": { "var_temp":"{{FileUrl}}" }

the “variables” part is thanks to reading some other topics.

unfortunately it’s not working - tried it with a script that notifies me on telegram:

  - service: notify.my_telegram_bot
      message: "here goes nothing: {{ var_temp }}"

I tried adding something like adding this to data_template of webhook receiving automation:

var_temp: '{{ trigger.event.variables.var_temp }}'

no luck. so I’ve changed the message part of MY_SCRIPT:

message: "here goes nothing: {{ trigger.event.variables.var_temp }}"

but it didn’t work too [well, I’m not surprised, since trigger.event is for automation, not scripting, right?]


  1. how can I add some variable to json’s body - so it would be used by some scripts, and could be ignored while empty?
  2. couldn’t find this - is the “call_service” in “action” part, a mandatory thing for calling a service? or is it just a keyword that can be later checked in the automation? [if it’s just a keyword, maybe I could make some “action” like “send_variable” and then solve the rest with conditions within automation?]
1 Like

I face the same probleme. Up ?

All those parameters sent from IFTTT are completely arbitrary. In fact, I would recommend against allowing any webhook to call any service blindly. IMO, now that we can define webhook automations, we don’t even really need the IFTTT integration at all.

Don’t consider the parameters to be actually calling things in HA, they are just strings that you can use to identify what IFTTT call is being made.

I’ll try and post some examples when I’m at a real keyboard.

In my my case, and for example, i want turn on a script when i get a new follower on twitter (with Twitter IFFF Service). When i get a new one, i want to flash lights then say it on my Google Home with the name of the new follower.

So I created a script that flashes lights and say something. In this something, i want to retrieve the name of the follower that is a IFTTT recipe. This name, i want to pass it as value of the body of my webhook. But i can’t find a way to pass it to my script with the ifttt_webhook_received automation.

In my IFTTT, I just set it up to use a webhook, and use the following parameters

  • URL: https://your_ha.duckdns.org/api/webhook/[YOUR_WEBHOOK_ID]
  • Method: POST
  • Content type: application/json
  • Body: some JSON, e.g., {"condition":"blarg", "param1":"thing1", "param2":"thing2"}

Then in HA, I set up a webhook automation using the same ID:

  - alias: my_ifttt_automation
      - platform: webhook
        webhook_id: [YOUR_WEBHOOK_ID]
      - condition: template
        value_template: "{{ trigger.json.condition == "blarg" }}"
      - service: whatevs
          foo: "{{ trigger.json.param1 }}"
          bar: "{{ trigger.json.param2 }}"

No need for the IFTTT integration event whatsoever, but make sure to keep your webhook ID secret. I typically use two GUIDs concatenated together, so something like this:


You can use this website to generate GUIDs.

Edit: formatting.


Ok thanks. Its a good alternative except you need to have 1 Webhook ID for 1 automation and also for 1 specific service call that accept these parameters.

The good point with ifttt_webhook_received is that there is only 1 automation whatever the service you want to call. But you cant pass any other parameters :frowning:

You can pass the service in the json and use a service_template if that’s what you want, but I wouldn’t do that. Use a separate webhook for each logical action.

1 Like

You probably right :slight_smile:
Thanks for your time and your advices !

Edit : works well :+1:

1 Like