Project

General

Profile

As an administrator, how to send private messges to all the users?

Bruce Chung
Added over 2 years ago

As an administrator, I want to send private messges to all the users.

The users are not in the roster list of the administrator.

And need to support offline message.


Replies (1)

Added by Daniel Wisnewski IoT 1 Cloud over 2 years ago

Hi Bruce

This is a feature available to XMPP, you can call this by sending an IQ stanza to session manager

<iq type="set" to="sess-man@server.net" id="aad8a">
<command xmlns="http://jabber.org/protocol/commands" node="http://jabber.org/protocol/admin#announce"/>
</iq>

You will get a form response from sess-man with instructions

<iq from="sess-man@server.net" type="result" id="aad8a" to="admin@server.net/mobile">
<command xmlns="http://jabber.org/protocol/commands" status="executing" node="http://jabber.org/protocol/admin#announce">
<x xmlns="jabber:x:data" type="form">
<title>Message to online users</title>
<instructions>Fill out this form to make an announcement to all active users of this service.</instructions>
<field type="hidden" var="FORM_TYPE">
<value>http://jabber.org/protocol/admin</value>
</field>
<field type="jid-single" label="From address" var="from-jid">
<value>birdbox</value>
</field>
<field type="text-single" label="Subject" var="subject">
<value>Message from administrators</value>
</field>
<field type="list-single" label="Type" var="msg-type">
<value>normal</value>
<option label="normal">
<value>normal</value>
</option>
<option label="headline">
<value>headline</value>
</option>
<option label="chat">
<value>chat</value>
</option>
</field>
<field type="text-multi" var="announcement">
<value/>
</field>
</x>
<actions execute="complete">
<complete/>
</actions>
</command>
</iq>

Send back the response

<iq type="set" to="sess-man@server.net" id="aad9a">
<command xmlns="http://jabber.org/protocol/commands" node="http://jabber.org/protocol/admin#announce">
<x xmlns="jabber:x:data" type="submit">
<field type="hidden" var="FORM_TYPE">
<value>http://jabber.org/protocol/admin</value>
</field>
<field type="jid-single" var="from-jid">
<value>birdbox</value>
</field>
<field type="text-single" var="subject">
<value>Message from administrators</value>
</field>
<field type="list-single" var="msg-type">
<value>headline</value>
</field>
<field type="text-multi" var="announcement">
<value>Restarting server!</value>
</field>
</x>
</command>
</iq>

You will receive an IQ response when it is successful

<iq from="sess-man@server.net" type="result" id="aad9a" to="admin@server.net/mobile">
<command xmlns="http://jabber.org/protocol/commands" status="completed" node="http://jabber.org/protocol/admin#announce">
<x xmlns="jabber:x:data" type="result">
<field type="fixed" var="Note">
<value>Operation successful</value>
</field>
</x>
</command>
</iq>

Users will receive the following message:

<message from="server.net" type="headline" to="user@server.net" id="admin">
<body>Restarting server!</body>
<subject>Message from administrators</subject>
</message>

You can also access this command in Psi by selecting Service Discovery > Session Manager > Execute Command > Send Announcement to Online Users

    (1-1/1)