Restful notify with textmagic.com

I use textmagic.com to send SMS messages and whilst I could send messages easily enough using curl from the cli, I struggled a bit to get restful notifications working in HA. Here therefore is my config, more for my own records than anything else:

configuration:

notify:
  - name: textmagic
    platform: rest
    resource: "https://rest.textmagic.com/api/v2/messages"
    method : POST_JSON
    data_template:
      text: "{{ message }}"
      phones: "{{ target }}"
    headers:
      X-TM-Username: !secret tmuser
      X-TM-Key: !secret tmkey

Node-red notification:

{
    "message": "testing 123",
    "target": "44XXXXXXXXXX",   
}
1 Like

This was insanely helpful.

I spent 2 hours trying to find how did I access the message and target from request, I missed the simple option of templating and calling the parameter name.

Thank you.