IFTTT pass aditional values to a automation or script

I am trying to parse extra information from IFTTT to Home Assistant.

More specificaly trying to say to my google home Clean Kitchen. Than parsing the Kitchen part with an extra command to run a certain script in Home Assistant.

Now i already have had IFTTT setup before with Home assistant and i found this new way to parse extra data wich does work:

automation old 2:
- alias: "event put through"
  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 }}'
      command: '{{ trigger.event.data.command }}'
      params: '{{ trigger.event.data.params }}'

With this line in IFTTT:

{ "action": "call_service", "service": "vacuum.send_command", "command": "app_segment_clean", "params": "19", "entity_id": "vacuum.roborock" }

And finaly this has to run a python script because of the number not being input corectly:

Alright great you would think. But i also use the same Ifttt_webhook trigger to for example turn on or off a light. and when trying to use the same webhok to turn on or of a light for exmaple

{ "action": "call_service", "service": "homeassistant.turn_on", "entity_id": "light.porch_strip" }

This wont work anymore probaly because it is now searching for a value for

  command: '{{ trigger.event.data.command }}'
      params: '{{ trigger.event.data.params }}'

Wich is in the IFTTT automation, but if i remove these i cant find an other way to send the extra data. I have been reading all over the forums but have not found a solution for this.

Any lead in the right direction would be greatly apreciated.

Here’s mine, been trying to make a generic ‘Execute $’ Applet in IFTTT that’ll then be parsed and run whatever I want in HA based on what’s passed.

So I have a Google Assistant -> Webhook Applet.

IFTTT:

{ "action": "execute", "service": "script.ifttt_execute", "ifttt_text":"{{TextField}}" }

Automation in HA:

- id: '1555877822388'
  alias: Webhook from IFTTT w/Execute Text
  trigger:
  - event_data:
      action: execute
    event_type: ifttt_webhook_received
    platform: event
  condition:
    condition: template
    value_template: '{{ trigger.event.data.service == ''script.ifttt_execute'' }}'
  action:
  - service_template: '{% set ex = trigger.event.data.ifttt_text.lower() %} {% if
      ''pool'' in ex and ''fill'' in ex %} {% set what = ''pool_filler'' %} {% elif
      ''asdf'' in ex %} {% set what = ''do_nothing'' %} {% else %} {% set what = ''do_nothing''
      %} {% endif %} script.{{what}}'

Then I have a script.pool_filler that will turn my pool filler on for 10 minutes via Rachio. My thought is to build out the if / elif logic and ‘listen’ for open/close/turn on/turn off/hold/ etc and trigger scripts that way - things that are more complex than switches that Google will recognize already.

THanks for your reply. I see what your doing but it is a lot different from what im trying to do.
So sadly i can not really use this. And i think i will have to resort to making an script or automation for every room and also make a Applet in IFTTT for every room. I was hoping for a more generic aproach but cant not really find an easy example how to parse the extra data into home assistant.

You should be able to take parts of my example and apply them to your needs. Believe IFTTT also allows a Text and Number Input, so could add that as well fairly easily. I do have a lot of IFTTT applets that execute only one script, but w/ their paid plan now, was trying to condense and get away with only 1. Bit the bullet and paying them, worth it for me, but always fun to tinker around.

Basicly the above is working for me, BUT with the exeption that when i dont have a command or params to use in the ifttt json that i send i get the following error:

event put through: Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['command']

So basicly what i need in the automation is a way to check if there is data send within comand and params and if not dont use it.

Or i need to be able to make 2 different automations. But i dont understand how to trigger the different ones because the trigger is the iftt_webhook_received so how do i filter it out?

I have found a solution now i have setup 2 different automations one fires when i use call_service and one fire when i use execute as the action.

automation old 2:
- alias: "event put through max callservice"
  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 }}'
      command: '{{ trigger.event.data.command }}'
      params: '{{ trigger.event.data.params }}'

automation old :
- alias: "event put through min execute"
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
      action: execute
  action:
    service_template: '{{ trigger.event.data.service }}'
    data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'

Now i need to find a way to filter if i send:

{ "action": "call_service", "service": "python_script.vacumm_send_command", "command": "app_segment_clean", "params": "{{Textfield}}", "entity_id": "vacuum.roborock" }

And textfield wil be for exmaple: Kitchen, living room or bathroom.
I need the text to be replaced with the numer 19,18 or 20.

Maybe i should try to do this in the python script that i am using?