How should one handle sending xmpp welcome messages when users subscribe to bot (in general)

StackOverflow https://stackoverflow.com/questions/1480972

  •  18-09-2019
  •  | 
  •  

Question

As the title says, I would like to send a welcome message when a user subscribes to a bot.

However, as I understand it, presence subscribe stanzas should not contain a from-JID that includes resource (and my testing with Adium indicates that is also the case). That is, welcome message could easily be sent to the bare JID but is that really the right way to do it? It feels like it should be sent to the actual instance where the subscription originated.

Perhaps I'm seeing a problem where there is none? If not, any ideas on how to solve it?

Was it helpful?

Solution

Do not fear sending a message to a bare JID. Almost all the time this is what you want. The user may already have a fantastic system in place using priority to get the answer at the right device, like a blackberry, their home jabber client, the one at work, and so on. Heck, they may have sent the request from their blackberry that has a 0 priority, and they want to get the answer back at their desk.

Just send a message stanza with a type of headline, since you don't want them to reply to the notice.

OTHER TIPS

The things said about messages are all right. If you care about whom to send presence subscribe stanzas to, I wonder whether you really know resources at that time. IIRC, resources are stripped off before forwarding presence subscribes and I assume that you are responding to them. Furthermore, the bot wants to be informed about all presences, so subscribing to the bare jid is the right thing to do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top