How to get actionable notifications using Slack

Sorry to revive an old topic :sweat_smile:

I’m trying to get actionable notifications working for Slack as well, but I cannot get it sorted.
For me the RESTful command does not result in a message being posted in Slack.
The Slack notification service works for me, so I have the Slack app and API token set up correctly.

For getting the channel ID I went to the slack browser app and went to my message channel.
The URL has the following format:
https://app.slack.com/client/T12345ABCDE/C12345ABCDE/C12345ABCDE
So I figured C12345ABCDE is the channel ID.

Calling the following service however result in no success:

service: rest_command.slack_api
data:
  api: chat.postMessage
  payload:
    channel: C12345ABCDE
    text: "My amazing test message"

Debug logs for the rest_command show:

Success. Url: https://slack.com/api/chat.postMessage. Status code: 200. Payload: b"{‘channel’: ‘C12345ABCDE’, ‘text’: ‘My amazing test message’}"

All seems to be OK except that no message is posted.
Has anything changed recently causing this method to break?
Any other clues of what I could have done wrong?

Having an issue with the slack_webhook automation, I can see that when I press the button, the webhook has been received, but the condition and action are not triggering.

In the original, the action was - service_template: which has been deprecated, when googled, u can now run it under - service: instead, but I’m not sure if that’s whats causing the automation to not run.

  alias: slack_webhook
  trigger:
    - platform: webhook
      webhook_id: webhook_id1
  condition:
    - condition: template
      value_template: >
        {% set payload = trigger.data.payload | from_json %}
        {{ (payload.token == insert verification token here) and (payload.type == 'interactive_message') }}
  action:
    - service: >
        {%- set payload = trigger.data.payload | from_json -%}
        script.{{ payload.callback_id }}
      data_template:
        payload: '{{ trigger.data.payload }}'
mode: parallel

Edit: I used input_text for the verification token and now the automation is able to run but I’m not sure why the switch is not turning off

webhook script:

webhook_id1:
  sequence:
    - service: script.callback_handled
      data_template:
        replace_original: true
        payload: "{{ payload }}"
    - condition: template
      value_template: >
        {%- set action = (payload | from_json).actions[0] -%}
        {{ (action.value == "Close it") and not (action.name == "")}}
    - service: switch.turn_off
      data_template:
        entity_id: >
          {%- set entity_id = (payload | from_json).actions[0].name -%}
          switch.{{ entity_id if (not entity_id.startswith("switch.")) else entity_id[6:] }}

Notify slack script service:

service: script.notify_slack
data_template:
  channel: "C041HSRR887"
  message: "The Virtual switch is on."
  attachments:
    - title: Turn off the switch?
      callback_id: webhook_id1
      color: '#03a9f4'
      attachment_type: default
      actions:
        - text: Close it
          value: Close it
          name: 'switch.virtual_switch_1'
          type: button
        - text: Leave it
          value: Leave it
          name: 'anything_just_not_blank'
          type: button

Edit 2: So i have tried the og with cover entities instead and that seems to work, is there a way to make it work with different entity type like switch. instead of only cover.? (managed to find out, just had to change the last service part of the script.)