Usage

These are some examples. For more info, check the API documentation.

Registration

How to get CAPTCHA!

curl -d '{"use_voice": true, "captcha": "'${CAPTCHA}'"}' http://localhost:8080/v1/register/${account}
curl -X POST http://localhost:8080/v1/register/${account}/verify/${token}

Plain text

curl -d '{"message": "foo"}' http://localhost:8080/v1/send/${phonenumber}
curl -d '{"recipients": ["${phonenumber}"], "message": "foo", "number": "${account}"}' http://localhost:8080/v2/send

With attachments

Attachments needs to be bas64 encoded (e.g. base64 -w 0 < file).

curl -d '{"message": "bar with image", "base64_attachments": ["base64-encoded-string"]}' http://localhost:8080/v1/send/${phonenumber}
curl -d '{"recipients": ["${phonenumber}"], "message": "bar with image", "number": "${account}", "base64_attachments": ["base64-encoded-string"]}' http://localhost:8080/v2/send

Send to groups

You can find the group id via an API call or from the files in signal-cli data directory (~/.local/share/signal-cli/data/<account-id>)

You need to replace /, + and = with - (dash) for v1

curl -d '{"message": "foobar to all"}' http://localhost:8080/v1/send/${groupid.replace("/", "-")]
curl -d '{"recipients": ["${groupid}"], "message": "foobar to all", "number": "${account}"}' http://localhost:8080/v2/send

Send with mentions

See upstream issue:

specifies start index and length for each mention 3:1:+NUMBER_MENTION

This example will prepend (Index=0, Length of replacement=0) the whole message with a single mention:

curl -d '{"recipients": ["${groupid}"], "message": "foobar to all", "number": "${account}", "mentions": ["0:0:${phonenumber}"]}}' http://localhost:8080/v2/send