Skip to content

An Ejabberd module for routing messages received as HTTP POSTs.

Notifications You must be signed in to change notification settings

skeltoac/http_message

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

http_message - An Ejabberd module for routing messages received as HTTP POSTs.

Having a web server talk XMPP just to post a message to XMPP is excruciatingly inefficient in developer, machine, and user time. This is an Ejabberd module that accepts an HTTP POST with Basic Auth and passes the message directly the XMPP router. It's simple, easy, and about as efficient as it could be.

Features

Forge Sender: The module allows privileged users to send messages from arbitrary JIDs. The specified JID doesn't have to be an existing account; it doesn't even have to be on a real domain. Caveat emptor: know thy protocol, this is not standard; messages sent S2S will be discarded by the remote server if the domain doesn't match.
<message to="[email protected]" from="deus@machina">
<body>Hello, world!</body>
</message>

Multicast: The module includes a stripped-down, non-compliant XEP-0033 multicast implementation. If your message has to="multicast" it will check the multicast ACL and then send the message, minus the addresses, to all recipients specified. This is essentially a BCC-only multicast service.
<message to="multicast">
<addresses>
<address jid="[email protected]"/>
<address jid="[email protected]"/>
</addresses>
<body>Hello, world!</body>
</message>

Installation

1. Compile and install the beam file in your ejabberd ebin directory. The included Makefile is configured for ejabberd installed in /lib/ejabberd; if that matches your system, simply `make install`.

2. Add ACLs. Start with these:
http_message [{allow, local}]
multicast [{allow, admin}]
forge_sender [{allow, admin}]

3. Add request handlers to the HTTP/HTTPS listener(s).
{request_handlers,
  [{["message"], http_message}]}

4. If you did steps 2 & 3 in the config file, restart ejabberd. If you did them in the web admin panels, you don't have to restart.

5. Check it out. Browse to /message on your ejabberd server's HTTP/HTTPS port; it should report an error about "Method not allowed." Use curl to send a message:
curl https://example.com:5284/message -u [email protected] --data-binary '<message to="[email protected]"><body>Hello, world!</body></message>'

About

An Ejabberd module for routing messages received as HTTP POSTs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages