signal-cli icon indicating copy to clipboard operation
signal-cli copied to clipboard

How to get all jsonrpc methods, including request and response params?

Open thefinn93 opened this issue 1 year ago • 4 comments

I'm looking for a way to get a list of all jsonrpc methods and their associated request/response params, ideally in a machine-readable format. I'm hoping to use this to generate a client, rather than manually re-typing the entire protocol. Is this something that is already supported? If not, is it something there would be interest in supporting?

Thanks

thefinn93 avatar Dec 29 '24 23:12 thefinn93

There's currently no machine-readable documentation. The JSON-RPC commands are based on the cli arguments (see JSON-RPC man page and cli man page)

I've had some ideas for creating a new API for defining commands, that can generate the argparse4j commands for the cli and parse JSON-RPC requests (with better validation, than the current state). That API could then also be used to generate machine-readable documentation and maybe also for shell-completions. However that's just some rough ideas and no code yet.

AsamK avatar Jan 02 '25 15:01 AsamK

Hello, thank you for your work on this repository. I am still not sure exactly how the command-line commands transfer to JSON-RPC commands:

For example: This works: signal-cli send --group "YVs2/HSkS8viSYndY2hw3dHIFfWAR2Wl88/VNU/PreY=" --message "Hello, world!"

This works: signal-cli send --message "Hello, world!" +1xxxxxxxxxx

And this works: {"id":17,"jsonrpc":"2.0","method":"send","params":{"message":"Hello, world!","recipient":"+1xxxxxxxxxx"}}

However, this does not work: {"id":15,"jsonrpc":"2.0","method":"send","params":{"group":"YVs2/HSkS8viSYndY2hw3dHIFfWAR2Wl88/VNU/PreY=","message":"Hello, world!"}}

It returns the following: {"jsonrpc":"2.0","error":{"code":-1,"message":"No recipients given","data":null},"id":15}

gabrc52 avatar Apr 26 '25 21:04 gabrc52

It appears that group-id instead of group worked. I was split between whether I needed to pass something to recipient even if it is a group (like null explicitly) but it turns out it did not recognize group but does recognize group-id. Even if a human-readable but not machine-readable format, some instructions about how to make the JSON-RPC calls based on the --help would be helpful.

gabrc52 avatar Apr 26 '25 22:04 gabrc52

There's currently no machine-readable documentation. The JSON-RPC commands are based on the cli arguments (see JSON-RPC man page and cli man page)

I've had some ideas for creating a new API for defining commands, that can generate the argparse4j commands for the cli and parse JSON-RPC requests (with better validation, than the current state). That API could then also be used to generate machine-readable documentation and maybe also for shell-completions. However that's just some rough ideas and no code yet.

Hi - I'm taking a look at maybe building this. Would defining JSON schema files in a top-level schemas directory, plus then generating Java classes for each command's arguments into src/main/java/org/asamk/signal/commands out of those schemas at dev time (checked into source control) sound good?

vergenzt avatar Jul 11 '25 14:07 vergenzt