0
votes

I am working on sending message to muc room via API http. I observed that it s possible by get_room_occupants users who has joined muc room.

Now, from ejabberd muc room I have found that team members are there but are not occupants of the team, thats why is shows this error Only occupants are allowed to send messages to the conference though being group members.

Is there any api which can connect me to muc and show me in occupants?

Ejabberd Version : 17.11 Installed on : ubuntu 16.04 Configuered DB : mysql

Ejaberd.yml

api_permissions:
  "console commands":
    from:
      - ejabberd_ctl
    who: all
    what: "*"
  "admin access":
    who: all
    what:
      - "*"
      - "!stop"
      - "!start"
  "public commands":
    who: all
    what:
      - "*"
commands_admin_access:
  - allow:
    - user: "[email protected]"
commands:
  add_commands:
    - status
    - registered_users
    - register
    - unregister
    - get_roster
    - connected_users
    - send_stanza_c2s
    - send_stanza
    - join_cluster
oauth_expire: 3600
oauth_access: all
1
Can you share me the permissions of the group?Niranj Rajasekaran
I have updated the question. Please have a lookArpit Vaishnav

1 Answers

1
votes

An account with admin rights in the MUC service can send messages to any room, no need to be room occupant.

For example, with this configuration:

acl:
  admin:
    user:
      - "user1@localhost"
modules:
  mod_muc:
    access_admin:
      - allow: admin

I can execute this query, providing an account that exist and a room that exists, but that account is not occupant in that room:

$ ejabberdctl send_message groupchat user1@localhost [email protected] Sub Bodyyy

The occupants in that room receive the message:

<message to='user2@localhost/tka1'
    from='[email protected]'
    type='groupchat'
    id='1234779465623896577'>
  <body xml:lang='en'>Bodyyy</body>
  <subject xml:lang='en'>Sub</subject>
</message>

Alternatively, you can subscribe an account to a MUC room, and then that account is allowed to send messages to the room without being occupant. For example:

$ ejabberdctl subscribe_room user2@localhost/tka1 User2 [email protected] urn:xmpp:mucsub:nodes:messages
urn:xmpp:mucsub:nodes:messages

$ ejabberdctl send_message groupchat user2@localhost [email protected] Sub Bodyyy