Search code examples
c#botframework

botframeworkv4 - List of available Channel IDs


While exploring the new preview of the botframeworkv4 in C#, I came across a case where I need to do a specific action for a certain channel. In botframeworkv3, I used to access all the channels string names using ChannelIds but I can't find it here.

I know that I can directly write "facebook" for example, but using the provided list prevents any typos and improves readability.

Therefore, what is the equivalent of ChannelIds in botframeworkv4?


Solution

  • ChannelIds has been replaced with Channels in the C# V4 SDK and is available under Microsoft.Bot.Connector.

    Checking for a specific channel can be done easily, for example:

    var isEmail = turnContext.Activity.ChannelId == Channels.Email;
    

    Use Nicholas R's answer if you need to add custom channels (or example Android, iOS) to the list.