Addon communication

So I’m looking to send information between two (maybe more) players with my addon (voluntarily of course) and wondering what the best way to do so is. I don’t want the information to show up in chat, it’s meant to be handled by the addon itself. Similarly, it’s also not meant to be a broadcast for every person who is using the addon just specific ones. Think User A inviting User B so the addon on User B’s PC pops up a dialog box where User B can accept. The addon can then send some data back and forth between the two users.

I looked at https://wowpedia.fandom.com/wiki/API_C_ChatInfo.SendAddonMessage and I’m not sure whether this is the right option (it looks like it). But before I meander down what may be the wrong path is that what I should use or is there a better approach?

Yes, C_ChatInfo.SendAddonMessage is the expected way to communicate between addons in a background channel, and it can be targeted to another specific user with the whipser argument.

Before they added this (it was SendAddonChatMessage when introduced) addons were typically making a chat channel or other more visible ways to pass data and it was ugly. Blizzard added this for addons to do their background communication without abusing the other chat channels and players who didn’t have the addon.

1 Like

Cool. Thanks for that. It looked like the right choice, but I really didn’t want to spend hours (days!) working on it only to find there was a better way.