Sometimes it’s useful to have different interfaces to access XMPP.
This module allows sending XMPP <message>
stanzas via a simple HTTP API.
curl http://example.com:5280/msg/user -u me@example.com:mypassword -H "Content-Type: text/plain" -d "Server@host has just crashed!"
This would send a message to user@example.com from me@example.com
/msg/ [recipient [@host] ].
The base URL defaults to /msg
. This can be configured
via Prosodys HTTP path
settings.
Authentication is done by HTTP Basic.
Authentication: Basic BASE64( "username@virtualhost:password" )
Supported formats are:
text/plain
<body>
element.
application/x-www-form-urlencoded
application/json
Which one is selected via the Content-Type
HTTP
header.
The form data and JSON formats allow the following fields:
to
type
body
<body>
element.
Some code originally borrowed from mod_webpresence
mod_rest is a more advanced way to send messages and more via HTTP, with a very similar API.
With the plugin installer in Prosody 0.12 you can use:
sudo prosodyctl install --server=https://modules.prosody.im/rocks/ mod_post_msg
For earlier versions see the documentation for installing 3rd party modules