From bc92ef3c19fb6b9c2c4fed12aa8283d7c0b7bdea Mon Sep 17 00:00:00 2001 From: Joop Date: Mon, 6 Mar 2023 16:26:09 +0000 Subject: [PATCH] Update signal_messenger.markdown (#26441) Co-authored-by: Franck Nijhof --- .../_integrations/signal_messenger.markdown | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/source/_integrations/signal_messenger.markdown b/source/_integrations/signal_messenger.markdown index 5a8ce36120b..8855e0d0f74 100644 --- a/source/_integrations/signal_messenger.markdown +++ b/source/_integrations/signal_messenger.markdown @@ -65,6 +65,40 @@ recipients: type: string {% endconfiguration %} + +## Sending messages to Signal to trigger events + +You can use Signal Messenger REST API as a Home Assistant trigger. In this example, we will make a simple chatbot. If you write anything to your Signal account linked to Signal Messenger REST API, the automation gets triggered, with the condition that the number (attribute source) is correct, to take action by sending a Signal notification back with a "Message received!". + +To accomplish this, edit the configuration of Home Assistant, adding a [RESTful resource](/integrations/rest/) as follows: + +```yaml +- resource: "http://127.0.0.1:8080/v1/receive/" + headers: + Content-Type: application/json + sensor: + - name: "Signal message received" + value_template: "{{ value_json[0].envelope.dataMessage.message }}" #this will fetch the message + json_attributes_path: $[0].envelope + json_attributes: + - source #using attributes you can get additional information, in this case, the phone number. + ``` +You can create an automation as follows: + +```yaml +... +trigger: + - platform: state + entity_id: + - sensor.signal_message_received + attribute: source + to: "" +action: + - service: notify.signal + data: + message: "Message received!" +``` + ## Examples A few examples on how to use this integration as actions in automations.