Maximilian K.
Maximilian K.

Reputation: 227

Conversation.SendToConversation throw error unknown botId

I'm developing a ChatBot with the Microsoft Botframework. When I'm sending a message with activity.CreateReply and ReplyToActivityAsync everythink working fine in WebChat, Skype and Telegram:

var reply = activity.CreateReply(activity.Recipient.Id);
await connectorClient.Conversations.ReplyToActivityAsync(reply);

But when I try to send a new message directly without a previous activity, in Telegram I'm getting a unknown botId Exception. Skype and WebChat are working fine.

new ConnectorClient(new Uri(data.ServiceUrl)).Conversations.SendToConversationAsync(
    new Activity
    {
        ChannelId = data.ChannelId,
        From = new ChannelAccount(id: data.BotId),
        Conversation = new ConversationAccount(id: data.ConversationId),
        Type = ActivityTypes.Message,
        Text = text
    });

I've tried different botIds for the "From" part. Currently I'm using the original id from the activity, when I'm storring the data, but I've tried the Telegram name and the BotFramework handle too.

The unknown botid exception has a whitespace behind botid, but there is nothing behind:

// Code to Output exception:
ex.GetType().Name + ": " + ex.Message

// result
"HttpOperationException: Unknown botId "

Upvotes: 2

Views: 250

Answers (2)

  Lafannn
Lafannn

Reputation: 1

This error occurs if you only specify the ID new ChannelAccount(botId) If you add the name new ChannelAccount(botId, botName), everything will work

Upvotes: 0

Related Questions