Skip to content

How can templates get inserted into the JSON for the webhook? #1

@ertechdesign

Description

@ertechdesign

Hello,

Thank you for an amazing plugin, it works like a charm.

My problem is I don't know how to insert templates into the Webhook. I'm not particularly good with HA templates or Python, so I apologise if this question is completely stupid. I've tried something like this but it seems the resulting type is not a string:

service: webhook_service.basic_webhook
data:
  webhook: >-
    https://mywebhookurl.domain/webhookpath?token=something
  json: "{\"state\": \"{{ states.sun.sun.attributes.elevation }}\" }"

I'm getting the following error in traces:
the JSON object must be str, bytes or bytearray, not Wrapper

Is there any chance an example of working template is shared?

Thank you very much for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions