Software /
code /
prosody-modules
Comparison
mod_post_msg/README.md @ 6211:750d64c47ec6 draft default tip
Merge
author | Trần H. Trung <xmpp:trần.h.trung@trung.fun> |
---|---|
date | Tue, 18 Mar 2025 00:31:36 +0700 |
parent | 6003:fe081789f7b5 |
comparison
equal
deleted
inserted
replaced
6210:24316a399978 | 6211:750d64c47ec6 |
---|---|
1 --- | |
2 summary: 'Receives HTTP POST request, parses it and relays it into XMPP.' | |
3 --- | |
4 | |
5 Introduction | |
6 ============ | |
7 | |
8 Sometimes it's useful to have different interfaces to access XMPP. | |
9 | |
10 This module allows sending XMPP | |
11 [`<message>`](https://xmpp.org/rfcs/rfc6121.html#message) stanzas via a | |
12 simple HTTP API. | |
13 | |
14 Example usage | |
15 ------------- | |
16 | |
17 curl http://example.com:5280/msg/user -u me@example.com:mypassword -H "Content-Type: text/plain" -d "Server@host has just crashed!" | |
18 | |
19 This would send a message to user\@example.com from me\@example.com | |
20 | |
21 Details | |
22 ======= | |
23 | |
24 URL format | |
25 ---------- | |
26 | |
27 /msg/ [recipient [@host] ]. | |
28 | |
29 The base URL defaults to `/msg`. This can be configured via Prosodys | |
30 [HTTP path settings][doc:http]. | |
31 | |
32 Authentication | |
33 -------------- | |
34 | |
35 Authentication is done by HTTP Basic. | |
36 | |
37 Authentication: Basic BASE64( "username@virtualhost:password" ) | |
38 | |
39 Payload formats | |
40 --------------- | |
41 | |
42 Supported formats are: | |
43 | |
44 `text/plain` | |
45 : The HTTP body is used as plain text message payload, in the `<body>` | |
46 element. | |
47 | |
48 `application/x-www-form-urlencoded` | |
49 : Allows more fields to be specified. | |
50 | |
51 `application/json` | |
52 : Similar to form data. | |
53 | |
54 Which one is selected via the `Content-Type` HTTP header. | |
55 | |
56 ### Data fields | |
57 | |
58 The form data and JSON formats allow the following fields: | |
59 | |
60 `to` | |
61 : Can be used instead of having the receiver in the URL. | |
62 | |
63 `type` | |
64 : [Message type.](https://xmpp.org/rfcs/rfc6121.html#message-syntax-type) | |
65 | |
66 `body` | |
67 : Plain text message payload which goes in the `<body>` element. | |
68 | |
69 Acknowledgements | |
70 ================ | |
71 | |
72 Some code originally borrowed from mod\_webpresence | |
73 | |
74 See also | |
75 ======== | |
76 | |
77 [mod_rest] is a more advanced way to send messages and more via HTTP, | |
78 with a very similar API. | |
79 |