mod_muc_webchat_url: Fix default url
[prosody-modules.git] / mod_post_msg / README.markdown
blob87da36d6ac8b29717f18c4f92a62c3175644f52a
1 ---
2 summary: 'Receives HTTP POST request, parses it and relays it into XMPP.'
3 ---
5 Introduction
6 ============
8 Sometimes it's useful to have different interfaces to access XMPP.
10 This module allows sending XMPP
11 [`<message>`](https://xmpp.org/rfcs/rfc6121.html#message) stanzas via a
12 simple HTTP API.
14 Example usage
15 -------------
17     curl http://example.com:5280/msg/user -u me@example.com:mypassword -H "Content-Type: text/plain" -d "Server@host has just crashed!"
19 This would send a message to user\@example.com from me\@example.com
21 Details
22 =======
24 URL format
25 ----------
27     /msg/ [recipient [@host] ].
29 The base URL defaults to `/msg`. This can be configured via Prosodys
30 [HTTP path settings][doc:http].
32 Authentication
33 --------------
35 Authentication is done by HTTP Basic.
37     Authentication: Basic BASE64( "username@virtualhost:password" )
39 Payload formats
40 ---------------
42 Supported formats are:
44 `text/plain`
45 :   The HTTP body is used as plain text message payload, in the `<body>`
46     element.
48 `application/x-www-form-urlencoded`
49 :   Allows more fields to be specified.
51 `application/json`
52 :   Similar to form data.
54 Which one is selected via the `Content-Type` HTTP header.
56 ### Data fields
58 The form data and JSON formats allow the following fields:
60 `to`
61 :   Can be used instead of having the receiver in the URL.
63 `type`
64 :   [Message type.](https://xmpp.org/rfcs/rfc6121.html#message-syntax-type)
66 `body`
67 :   Plain text message payload which goes in the `<body>` element.
69 Acknowledgements
70 ----------------
72 Some code originally borrowed from mod\_webpresence