Unable to receive messages using Signal Messenger integration

I’m able to send messages to my phone using the integration. But I can’t get receiving messages to work. I set everything up like in the manual. The integration is running in json-rpc mode.

- resource: "http://127.0.0.1:8080/v1/receive/<number>"
  headers:
    Content-Type: application/json
  sensor:
    - name: "Signal message received"
      value_template: "" #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.

and

...
trigger:
  - platform: state
    entity_id:
      - sensor.signal_message_received
    attribute: source
    to: "<yournumber>"
action:
  - service: notify.signal
    data:
      message: "Message received!"

Looking in the logs is giving me the following errors

2024-02-13 19:40:19.985 DEBUG (MainThread) [homeassistant.components.rest.data] Updating from http://127.0.0.1:8080/v1/receive/{mynumber}
2024-02-13 19:40:20.002 DEBUG (MainThread) [homeassistant.components.rest] Finished fetching rest data data in 0.017 seconds (success: True)
2024-02-13 19:40:20.002 DEBUG (MainThread) [homeassistant.components.rest.data] Data fetched from resource: Bad Request
{"error":"websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header"}
2024-02-13 19:40:20.002 WARNING (MainThread) [homeassistant.components.rest.util] REST result could not be parsed as JSON
2024-02-13 19:40:20.003 DEBUG (MainThread) [homeassistant.components.rest.util] Erroneous JSON: Bad Request
{"error":"websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header"}

Hello,

I think I may be having the same issue. I am trying to implement the exact same demo code, but I am using a Home Assistant Green :

"Logger: homeassistant.components.rest.util
Source: components/rest/util.py:33
Integration: RESTful (documentation, issues)
First occurred: 9:19:21 PM (278 occurrences)
Last logged: 11:08:00 PM

JSON result was not a dictionary or list with 0th element a dictionary"

The error disappears when I comment out this line :
json_attributes_path: $[0].envelope

I can receive the messages whithout issue when using the terminal. Sending messages work too.

Thanks for your help.

I’ve got the same issue on the websocket.

Not sure how to fix it.

Also, the rest sensor json attributes is missing a key, i think it should be content.

Otherwise, you are only retrieving the phone number.

Switch to normal or native and test.

My send works regardless. Receive only works on native and normal, but is super slow.

I’m also using Cloudflare Access, so it may be tunnel related.

Hello fr0sty !!

Assuming you’ve installed the official Signal Messenger Add-On, and it’s running in json-rpc mode…

The secret sauce that is most obviously missing from ALL OF THE DOCUMENTATION is simply this:

When set to MODE=json-rpc :

  • every and all interaction occurs with HTTP GET/POST/DELETE commands to the Signal Host : port

WITH THE GLARING EXCEPTION OF RECEIVING MESSAGES!!

  • receiving messages occurs over WebSocket connection using ws:// protocol

I’m not sure if HA does this by itself. However, I use NodeRed and it does have WebSocket nodes.

As soon as I connected that, receive messages flow in REAL TIME!!

All the errors you are viewing about the WebSocket client not using ws protocol… These log entries are caused by the RESTful sensor.

Comment out that sensor, and connect to the WebSocket, and all will be working.

Hey Lewis,
Sorry for my late response I somehow missed your last reaction. I installed NodeRed in my HA, but now I don’t know what to do next to make this work.

I posted a Node-RED flow in another post that has all the main API calls.

Import that flow into a new tab and follow the commented instructions.

the post with the flows for Signal API

Thank you for your post! I can see now that I receive the messages. But now I have to find out how node-red works. Parsing the output,etc :slight_smile: