Repository navigation
New JSON-RPC Api #679
Replies: 12 comments 37 replies
|
This is really great! An FYI for anyone interested, stdI/O can be easily redirected to a socket. See e.g. this question on superuser. One question offhand: shouldn't |
|
I've read through the changes. This seems pretty reasonable, though I'm a little confused about the implementation being split across files like that. Can you explain getRequestType and why have both JsonRpcCommand and JsonRpcLocalCommand? The documentation needs to clearly indicate that dashed separators are converted to camelcase. It might be helpful to merge the namespace of the outer command with that of the inner command so that the username etc don't have to be specified each time. I'll try updating my code against this next week. |
This matches spec, maybe we should warn users (perhaps on stderr?) that they haven't given an id for a method that has output. |
|
I added a page to the wiki: |
|
Many thanks for that feature! I just gave it a quick try and it works very well. Awesome work! Just one small thing: Would it be possible to expose the |
|
Doesnβt home assistant support REST for inbound events? So you just need to add that instead of echoing to a file. For example I have another script which does this for signal-cli, watching a folder for new files and passing them as a JSON-RPC send message. (Itβs easy to mount the folder in my containers and just echo into a file, the the actual sending mechanism is independent). |
|
Short question regarding the JSON-RPC API: I think the register/verify is currently not supported, right? (At least I am always getting the error Is that something that will be supported at some point or does the user first need to register the number in "standalone mode" before enabling JSON-RPC? |
|
hey all, I have been reading up on the JSON-RPC functionality. dumb question though, how would a user go about and implement this? # think of this as a cronjob that periodically
# (e.g. every 10 mins) fetches new messages
# different TMP file for each run
TMPF="messages-$(date +%s).log"
# receive first, e.g.
signal-cli receive > "$TMPF"
# parse and do stuff
./my-signal-parser "$TMPF"
# send result, e.g.
./my-script | signal-cli send +1234567890
# etcwhat would the simplest version of the JSON-RPC bot be? what was posted in #679 (reply in thread) , that is, saving to a file, seems a relatively clunky solution to me, because then you still have to design a way in which your "message parser" postprocessor reads the message file, without causing issues to the signal-cli process which is writing to it, without double-parsing messages and without dropping messages! any suggestions are welcome. thanks! |
It would be neat if there was an option to expose this interface over HTTP (listening on 127.0.0.1 by default) as well. I haven't yet tried to use JSON-RPC over sockets yet, but I have a couple reservations:
If there was a HTTP interface:
Thoughts? |
|
I've extend the |
|
JSON RPC is great extension! Thank you. I yet could not find an example on how to send to a group via JSON RPC |
|
Is there a way to upload attachments via the JSON-RPC API (e.g. images)? |
Uh oh!
There was an error while loading. Please reload this page.
I've implemented a JSON-RPC API using stdin/stdout, based on @technillogue's idea to reuse the existing commands.
It supports almost all current commands, except some
list*commands that don't have json output yet.There's no documentation yet, but the request syntax can be derived from the cli documentation.
signal-cli -u +XXX --output=json jsonRpcSome example requests:
Incoming messages are sent as JSON-RPC notifications:
I'd be happy for feedback, the API might still change before the next release.
All reactions