Update signal_messenger.markdown (#26441)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Joop 2023-03-06 16:26:09 +00:00 committed by GitHub
parent 6f05a80ce1
commit bc92ef3c19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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/<number>"
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: "<yournumber>"
action:
- service: notify.signal
data:
message: "Message received!"
```
## Examples
A few examples on how to use this integration as actions in automations.