Table of Contents
/Xmpp/SendPresenceSubscription
Allows the client to send a presence subscription from its account to an XMPP recipient. If the account to which the client is logged in has an approved Legal ID associated with it, this ID will be included in the request, to allow the recipient to know who has made the request.
JSON
- Request
{ "to":Required(Str(PTo)), "customXml":Optional(Str(PCustomXml)), "language":Optional(Str(PLanguage)), "id":Optional(Str(PId)) }
- Response (if successful)
{ "sent":Required(Bool(PSent)), "id":Required(Str(PId)), "RosterItem": { "bareJid": Required(Str(PBareJid)), "pendingSubscription": Required(Bool(PPendingSubscription)), "status": Required(Str(PStatus)), "name": Required(Str(PName)), "Groups": Required(Str(PGroups)?[]) } }
XML
- Request
<SendPresenceSubscription xmlns="https://waher.se/Schema/BrokerAgent.xsd" to=(Required(Str(PTo))) language=(Optional(Str(PLanguage))) id=(Optional(Str(PId)))> <[Optional(Str(PCustomXml))]> </SendPresenceSubscription>
- Response (if successful)
<PresenceSubscriptionResult xmlns="https://waher.se/Schema/BrokerAgent.xsd" sent=(Required(Bool(PSent))) id=(Required(Str(PId)))> <RosterItem bareJid=(Required(Str(PBareJid))) pendingSubscription=(Required(Bool(PPendingSubscription))) status=(Required(Str(PStatus))) name=(Required(Str(PName)))> <Groups> <[<Item><[Optional(Str(PGroups))]></Item>?[]]> </Groups> </RosterItem> </PresenceSubscriptionResult>
Input Parameters
Parameter | Description |
---|---|
PTo |
A Bare or Full JID (XMPP network address). |
PCustomXml |
Optional Custom XML that can be added to the presence subscription request. |
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 match responses. If no ID was provided in the call, a message ID will be generated. |
PBareJid |
Bare JID of roster item. |
PPendingSubscription |
If the account has a pending subscription request to the remote entity. |
PStatus |
Status of roster item. |
PName |
Name given to the roster item. |
PGroups |
Names of groups to which the roster item is assigned. |
Javascript Library
Use the following asynchronous method in the Javascript Library, to call this resource.
var Response = await AgentAPI.Xmpp.SendPresenceSubscription(To,CustomXml,Language,Id);
Note: The CustomXml
, Language
and Id
arguments are optional, and can be omitted, or set to null
or undefined
.