Table of Contents
/Xmpp/SendFormattedMessage
Allows the client to send a formatted chat message from its account to an XMPP recipient. A formatted message contains the message in plain text, Markdown and HTML. The recipient, depending on capabilities, will select the representation it handles best to present the message.
JSON
- Request
{ "to":Required(Str(PTo)), "message":Required(Str(PMessage)), "subject":Optional(Str(PSubject)), "language":Optional(Str(PLanguage)), "id":Optional(Str(PId)) }
- Response (if successful)
{ "sent":Required(Bool(PSent)), "id":Required(Str(PId)) }
XML
- Request
<SendFormattedMessage xmlns="https://waher.se/Schema/BrokerAgent.xsd" to=(Required(Str(PTo))) message=(Required(Str(PMessage))) subject=(Optional(Str(PSubject))) language=(Optional(Str(PLanguage))) id=(Optional(Str(PId))) />
- Response (if successful)
<StanzaResult xmlns="https://waher.se/Schema/BrokerAgent.xsd" sent=(Required(Bool(PSent))) id=(Required(Str(PId))) />
Input Parameters
Parameter | Description |
---|---|
PTo |
A Bare or Full JID (XMPP network address). |
PMessage |
The Markdown body of the message to send. This Markdown is converted to plain text, HTML and also sent as Markdown to the recipient, who can choose which representation to present. |
PSubject |
Optional subject of message. |
PLanguage |
Optional ISO 639-1 language code. |
PId |
Optional Message ID. |
Response Parameters
Parameter | Description |
---|---|
PSent |
If the XMPP stanza was sent or not. |
PId |
ID of stanza sent. Can be used to update message. If no ID was provided in the call, a message ID will be generated. |
Javascript Library
Use the following asynchronous method in the Javascript Library, to call this resource.
var Response = await AgentAPI.Xmpp.SendFormattedMessage(To,Message,Subject,Language,Id);
Note: The Subject
, Language
and Id
arguments are optional, and can be omitted, or set to null
or undefined
.