Sending events from IFTTT to Home Assistant - webhooks broken?

almost every topic I’ve found about this - is using the old method with url like https://XXX.duckdns.org/api/services/?api_password=YYY
but as we can configure integration with IFTTT now slightly differently - I’m using the “new” method and… it’s still failing for me :frowning:

as most of us in similar cases, I want to run a script after talking to Google Assistant. configuration & integration is done and works [I can see no errors tied with them in the logs. base_url & all the rest is set in config]. my IFTTT looks like this:

Make a web request:
  URL: https://XXX.duckdns.org:27/api/webhook/YYYYYYYYYYYYYYYYYYYYYYYYY
  Method: POST
  Content Type: application/json
  Body: { "action": "call_service", "service": "script.turn_on", "entity_id": "script.some_script" }

IFTTT is triggerred correctly, because after my configured hot word/sentence Google Assistant responses with my custom phrase and then nothing happens. script is not started. IFTTT logs show time when it was last runned, without errors. HA log isn’t showing anything new to me also [I mean: nothing IFTTT/script related].

Am I missing something?

You also need to create an automation with the following:

automation:
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
      action: call_service
  action:
    service_template: '{{ trigger.event.data.service }}'
    data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'
3 Likes

oh, I thought that automation is needed only if I didn’t specified service etc. in the body of IFTTT trigger…
my mistake then!

thanks, will check in a minute if it works :slight_smile:

hi @ [pejotigrek] did you solved this issue?
Can you please share. I got same issue even configured automation already.

hi!

it works for me exactly like in the post marked as soluton.
this is my exact automation:

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

and IFTTT config is like:

URL: https://MY.DUCKDNS.DOMAIN/api/webhook/MY.WEBHOOK.HASH
METHOD: POST
CONTENT TYPE: application/json
BODY: { “action”: “call_service”, “service”: “script.turn_on”, “entity_id”:“script.MY_SCRIPT” }

and simple phrases entered to your liking :slight_smile:

2 Likes

Thank you very much.
I found the mistake in my URL

Where? I have the same issue, I’m using the new URL format but it is not working…

I use this content in the body :

{ "action": "call_service", "service": "vacuum.start", "entity_id": "vacuum.kraken" }

Thx

1 Like

Hi
Please follow:

  1. Click to the integration, then config the IFTTT
    When the pop up appear, copy the URL link
  2. Go to IFTTT and setup your applet with URL above
  3. Create an automation as instructed
  4. It should work

Hi, I’m new with HA. I have a problem setting up the automation part. This is how my automation.yaml looks like

  • id: ‘1552841249457’
    alias: automate_ifttt
    trigger:
    • platform: event
      event_type: ifttt_webhook_received
      event_data:
      action: call_service
      action:
    • service_template: ‘{{ trigger.event.data.service }}’
      data_template:
      entity_id: ‘{{ trigger.event.data.entity_id }}’

Even the IFTTT event is fired, nothing happens. The only strange thing is that the internal homeassistant editors marks the action part of the automation as invalid action. But I can’t find the solution.
Thanks in advanced

hi! sorry for delay!

don’t know if it is an issue but in yaml spaces/formatting is VERY important! looking at the code you’ve pasted, I can see some troubles with formatting - maybe that’s it?

it should look like this:

- id: '1552841249457'
  alias: aut_ifttt
  trigger:
    - platform: event
      event_type: ifttt_webhook_received
      event_data:
        action: 'call_service'
  action:
    - service_template: '{{ trigger.event.data.service }}'
      data_template:
        entity_id: '{{ trigger.event.data.entity_id }}'

[pay attention to identation]. also - try putting “call_action” into single quotes like I did.
oh, and if you’re pasting the code here - try to use the proper formatting too [you can paste the yaml, select it and press “</>” button over the editing window here]. that will make us sure how your yaml looks like in terms of formatting :slight_smile:

1 Like

Thank you very much! That was the problem! Everything working now!

great! I’m happy that I could help :slight_smile:

That solved my problem!!!
I am using Nabu Casa to connect to my Home Assistant server.

Just to share my experience, in my case I was having a lot of troubles to get it working and the issue was with the " vs ” symbols. I just did copy and paste using ” instead of using " standard quotes.
It is fixed and working fine now.

2 Likes

This is doing my head in, I have set this up exactly the same and it does nothing. I see nothing in my logs either…

Is there a way to test my webhook url for any possible routing issues?

… must be an issue on IFTTT’s end, ran my POST request on https://apitester.com and it works perfectly.

check for any space/formatting issues, wrong quote-signs etc. many of my troubles with different automations/configurations were because of accidentally entered characters in the config. it’s possible that post may be working, but HA can’t deal with it because of some config issues.

Did you check your IFTTT activity log? It will tell you if your web POST happened, and whether it got a success response or a failure code.

would anyone happen to know how is it that we can read a value sent from IFTTT? For instance, I want to set my lights to xx brightness, how would I read that value in my automation? I’ve tried trigger.event.data.entity_id.value but that doesn’t work ( I get an error when running a check config in HASS).

Thanks

1 Like

I’m not sure, and can’t test it right now, but AFAIR you’ll need to add this to your IFTTT recipe’s body somewhere:

"variables": { "value1":"{{Text}}" }

and then, in automation it should work just with entering the {{ value1 }} variable.