Reputation: 3074
I'm using the C# Bot Framework library to retrieve some data from the Bot State Service. Whenever channelId == "emulator"
in the code below, it fails with a 400 Bad Request
. It looks like both Emulator versions 3.0.0.59 and 3.5.27 use this channel ID. Here's the returned payload:
{
"error": {
"code": "BadArgument",
"message": "Invalid channel ID"
}
}
Note that if I change channelId
to something else like "skype"
, it works as expected.
var credentials = new MicrosoftAppCredentials(id, password);
this.botState = new BotState(new StateClient(credentials));
var channelId = activity.ChannelId;
await botState.GetUserDataAsync(channelId, activity.From.Id);
Upvotes: 0
Views: 373
Reputation: 3074
Received this answer from the Bot Framework team:
For emulator they need to use the activity’s serviceurl when create the state client. Builder automatically does that in the connector client factory:
if (IsEmulator(this.address)) { // for emulator we should use serviceUri of the emulator for storage return new StateClient(this.serviceUri, this.credentials); }
That error is from state.botframework.com (which is the default endpoint for stateclient) since emulator is not a valid channelid for the state service.
Upvotes: 1