public AzureBotServiceMessage Publish(ChannelRequest request)
        {
            BearerToken    = (String)request.Channel.Config["bearerToken"];
            ConversationId = GetConversationId();
            string target      = request.Channel.Target;
            string channelType = target.Substring(target.IndexOf('@') + 1);

            AzureBotServiceMessage message = new AzureBotServiceMessage();

            message.From.Id = request.Id;
            message.Text    = $"notify {target}";

            if (channelType?.ToLower() == "slack")
            {
                message.Value = Slack.CreateSlackMessage(request);
            }
            else if (channelType?.ToLower() == "msteams")
            {
                message.Value = Teams.CreateAdaptiveCardMessage(request);
            }
            else
            {
                throw new Exception($"Unknown ChannelType [{channelType}].");
            }

            SendMessage(message);
            return(message);
        }
        public virtual SignalStatus SendToChannel(ChannelDbRecord channel, SignalDbRecord signal)
        {
            SignalStatus status = new SignalStatus
            {
                Code        = StatusCode.Success,
                ChannelType = channel.Type,
                Message     = "Success"
            };

            try
            {
                if (channel.IsActive == false)
                {
                    status.Code    = StatusCode.NotActive;
                    status.Message = "Channel Is Disabled.";
                }
                else if (channel.Type == "slack")
                {
                    SlackMessage message = Slack.Publish(signal.Id, channel, signal.Signal);
                    //status.Message = JsonTools.Serialize(message);
                }
                else if (channel.Type == "teams")
                {
                    MessageCard message = Teams.Publish(signal.Id, channel, signal.Signal);
                    //status.Message = JsonTools.Serialize(message);
                }
                else if (channel.Type == "azure-bot-service")
                {
                    AzureBotService        abs     = new AzureBotService();
                    AzureBotServiceMessage message = abs.Publish(signal.Id, channel, signal.Signal);
                    //status.Message = JsonTools.Serialize(message);
                }
                else
                {
                    throw new Exception($"Unknown Channel Type [{channel.Type}].");
                }
            }
            catch (Exception e)
            {
                status.Code    = StatusCode.Failure;
                status.Message = e.Message;
            }

            return(status);
        }