Search code examples
pythonxmppchatroomxmpppy

How to send message to a chatroom using xmpppy?


I've successfully sent message to individual user. How can I send message to a room? I'm trying the following code:

cl.send(xmpp.Message('99999_myroom@chat.hipchat.com', 'test message', typ='groupchat'))

Also, I'm sending this message without sending presence.


Solution

  • To send a message to a room, you must join the room first. From XEP-0045, section 7.2.2:

    <presence to='99999_myroom@chat.hipchat.com/my_nickname'>
      <x xmlns='http://jabber.org/protocol/muc'/>
    </presence>
    

    Then your message should work.