AsamK / signal-cli

signal-cli provides an unofficial commandline, JSON-RPC and dbus interface for the Signal messenger.
GNU General Public License v3.0
3.22k stars 306 forks source link

Issue with sendMessageRequestResponse via JSON RPC #1533

Closed kareldonk closed 6 months ago

kareldonk commented 6 months ago

I am sending the following JSON to the HTTP endpoint:

{
    "jsonrpc": "2.0",
    "method": "sendMessageRequestResponse",
    "params": {
        "recipient": "NUMBER OR UUID",
        "type": "accept"
    },
    "id": "THIS_ID"
}

And get the following error output in the CLI:

ERROR SignalJsonRpcDispatcherHandler - Command execution failed
java.lang.ClassCastException: class java.lang.String cannot be cast to class org.asamk.signal.commands.MessageRequestResponseType (java.lang.String is in module java.base of loader 'bootstrap'; org.asamk.signal.commands.MessageRequestResponseType is in unnamed module of loader 'app')
        at org.asamk.signal.commands.SendMessageRequestResponseCommand.handleCommand(SendMessageRequestResponseCommand.java:39)
        at org.asamk.signal.commands.JsonRpcLocalCommand.handleCommand(JsonRpcLocalCommand.java:25)
        at org.asamk.signal.commands.JsonRpcLocalCommand.handleCommand(JsonRpcLocalCommand.java:15)
        at org.asamk.signal.jsonrpc.SignalJsonRpcCommandHandler$CommandRunnerImpl.handleCommand(SignalJsonRpcCommandHandler.java:153)
        at org.asamk.signal.jsonrpc.SignalJsonRpcCommandHandler.parseParamsAndRunCommand(SignalJsonRpcCommandHandler.java:272)
        at org.asamk.signal.jsonrpc.SignalJsonRpcCommandHandler.runCommand(SignalJsonRpcCommandHandler.java:212)
        at org.asamk.signal.jsonrpc.SignalJsonRpcCommandHandler.handleRequest(SignalJsonRpcCommandHandler.java:90)
        at org.asamk.signal.http.HttpServerHandler.lambda$handleRpcEndpoint$1(HttpServerHandler.java:129)
        at org.asamk.signal.jsonrpc.JsonRpcReader.handleRequest(JsonRpcReader.java:134)
        at org.asamk.signal.jsonrpc.JsonRpcReader.handleMessage(JsonRpcReader.java:85)
        at org.asamk.signal.jsonrpc.JsonRpcReader.readMessages(JsonRpcReader.java:54)
        at org.asamk.signal.http.HttpServerHandler.handleRpcEndpoint(HttpServerHandler.java:129)
        at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:98)
        at jdk.httpserver/sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:82)
        at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:101)
        at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:871)
        at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:98)
        at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:847)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1570)

It appears to be complaining about the type value. According to the docs it should accept accept.

Send response to a message request to linked devices.

RECIPIENT
Specify the recipients’ phone number.

-g GROUP, --group-id GROUP
Specify the recipient group ID in base64 encoding.

-u USERNAME, --username USERNAME
Specify the recipient username or username link.

--type TYPE
Type of message request response (accept, delete)

Am I doing something wrong or is this a bug?

AsamK commented 6 months ago

It's a bug, will be fixed in the next version. Thanks for reporting.

kareldonk commented 6 months ago

Thank you