I'm trying to get away from the use of desktop Skype API with wrapper skype4com. I look in the direction of Microsoft Bot Framework. I created and registered my Skype bot with the Microsoft Bot Connector like here: Getting started with the Connector Also I added my bot into several group conversations. Now I have a task to write a message to a specific group conversation. For this I need to get a list of group conversations in which the bot is. I would like to get information about all group conversations my Skype bot such as conversation id and conversation name. I have been unable to find any information about it. Anyone know how to get a list of all groups conversations for Microsoft Bot?
2 Answers
When your bot is added to a conversation, it receives a message of type conversationUpdate
(see this page). You will have to maintain the list of conversations yourself, having some kind of a storage, following the changes signalled by this message type.
Example:
[BotAuthentication]
public class MessagesController : ApiController
{
private List<string> m_conversationIds;
public MessagesController()
{
m_conversationIds = new List<string>();
}
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity.Type != ActivityTypes.Message)
{
return await HandleSystemMessage(activity);
}
// ...
}
private async Task<HttpResponseMessage> HandleSystemMessage(Activity message)
{
if (message.Type == ActivityTypes.ConversationUpdate)
{
m_conversationIds.Add(message.Conversation.Id);
return Request.CreateResponse(HttpStatusCode.OK);
}
// ...
}
}
Of course, you might need additional pieces of information, not just the conversation ID. Also, you'll need to filter so that you only store the data when the update is about adding your bot to a conversation (as opposed to e.g. removing it).
NOTE: The example is just to get you started. An in-memory store like the list above is neither scalable nor robust.
Right now this is not enumerable within the Bot Framework SDK (or the protocol). The system assumes the bot caches information about the messages/groups its in when the bot is added to a given conversation. Get group info on launch