xmppejabberdejabberd-api

How to add members to Multi-User Chat Subscriptions like whatsapp using Admin Rest API


I am trying to create a chat application exactly like WhatsApp using Ejabberd server. I successfully create groups using admin APIs. But I can't add members to it. below is the request format. http://ejabberd.mysite.com:5281/api/create_room

 {
  "name": "roomAndroidTest3",
  "service": "conference.mysite.com",
  "host": "ejabberd.mysite.com",
   "options": [
    {
      "name": "members_only",
      "value": "true"
    },
     {
      "name": "allow_subscription",
      "value": "true"
    }

  ]
}

How can I add/delete members to this group? I don't find any rest API for this. I know how to add using subscription methods. But I want my server admin to handle all this functionality.

If this is not the right way, Please tell me how WhatsApp handling this functionality?

Already read these docs muc-pub, but not helped me


Solution

  • How can I add/delete members to this group?

    You can grant "member" affiliation with:

    https://docs.ejabberd.im/developer/ejabberd-api/admin-api/#set-room-affiliation

    For example, grant member:

    $ ejabberdctl set_room_affiliation sala1 conference.localhost user881@localhost member

    Revoke member:

    $ ejabberdctl set_room_affiliation sala1 conference.localhost user881@localhost none