Privileges

Note

XEP-0356: Privileged Entity” only works for XMPP users using the same server as slidge-whatsapp, e.g., eve@example.org on whatsapp.example.org.

Setting up slidge-whatsapp as a privileged entity (XEP-0356) is optional, but nice to have. It improves user experience with a few “cherry on top” features. By configuring your XMPP server such that slidge-whatsapp is a privileged entity, slidge-whatsapp can:

  • automatically add/remove “puppet contacts” from the XMPP roster of slidge-whatsapp users,

  • reflect on the XMPP side messages sent by users via official WhatsApp apps,

  • (if using HTTP Upload for attachments from WhatsApp to XMPP) request upload slots on behalf of slidge-whatsapp users, respecting any quota, retention, permission, or other policy set at the upload component level,

  • synchronize other actions done via official WhatsApp apps, such as marking messages as read, using emoji reactions, retracting messages, sending files…

  • automatically add XMPP bookmarks (XEP-0402) for MUCs (XEP-0045).

Server-specific instructions

Prosŏdy

Install the mod_privilege community module with:

prosodyctl install --server=https://modules.prosody.im/rocks/ mod_privilege

In prosody.cfg.lua, add mod_privilege to the modules_enabled list, and declare slidge-whatsapp privileges in the appropriate virtualhost block:

local _privileges = {
  roster = "both";       -- for adding/removing contacts from the users' rosters
  message = "outgoing";  -- for reflecting messages sent by the user themselve from official WhatsApp apps
  iq = {
    ["http://jabber.org/protocol/pubsub"] = "both";      -- for PEP Bookmarks
    ["http://jabber.org/protocol/pubsub#owner"] = "set"; -- for Message Display Synchronization
    ["urn:xmpp:http:upload:0"] = "get";                  -- for HTTP Upload on behalf of users
  }
};

VirtualHost "example.org"
  privileged_entities = {
    ["whatsapp.example.org"] = _privileges;
  }

Then either restart the prosody server, or reload the config. You might need to use mod_reload_component, and activate/deactivate hosts for all changes to be taken into account (restarting prosody is the easiest way to go).

ejabberd

acl:
  slidge_acl:
    server:
      - "whatsapp.example.org"

access_rules:
  slidge_rule:
    - allow: slidge_acl

modules:
  mod_privilege:
    roster:
      both: slidge_rule
    message:
      outgoing: slidge_rule
    iq:
      "http://jabber.org/protocol/pubsub":
        both: slidge_rule
      "http://jabber.org/protocol/pubsub#owner":
        set: slidge_rule
      "urn:xmpp:http:upload:0":
        get: slidge_rule
  mod_roster:
    versioning: true

Next step

Learn about about slidge-whatsapp’s configuration to tune its behaviour to your liking.