question

DanielQueijo-4386 avatar image
0 Votes"
DanielQueijo-4386 asked DanielQueijo-4386 edited

Not able to use Alexa as channel when using Bot Framework and Skills

Hi!

We are building a Bot using Bot Framework. The idea is to use a Consumer / Skill architecture, where we have an Assistant that forwards all questions to specialized skills. As channels, we use Alexa and Telegram.

With Telegram, we didn't find any issues so far. But with Alexa, we are not able to send messages from the Skills. It's like nothing happened. Here is some code to give you some context:

-> This is the skill invocation:

 var response = await _skillClient.PostActivityAsync(_botId, targetSkill, _skillsConfig.SkillHostEndpoint, turnContext.Activity, cancellationToken);

-> This is the skill receiving the invocation:

         protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
         {
             var messageText = $"This is a test";
             await turnContext.SendActivityAsync(MessageFactory.Text(messageText, messageText), cancellationToken);
         }

-> We've made the test of sending messages before and after the skill invocation as follows:

             await turnContext.SendActivityAsync("Before the skill",cancellationToken, InputHints.);
             // route the activity to the skill
             var response = await _skillClient.PostActivityAsync(_botId, targetSkill, _skillsConfig.SkillHostEndpoint, turnContext.Activity, cancellationToken);
    
             await turnContext.SendActivityAsync("After the skill",cancellationToken, InputHints.);

The Alexa response is completely avoiding the message from the Skill. The Alexa behavior is the following:

  • Before the skill

  • After the skill

And this is how it should be:

  • Before the skill

  • This is a test

  • After the skill

So, the message This is a test is never being said by Alexa.

Has anyone have any clue why this would be happening?

Thanks!



azure-bot-service
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@DanielQueijo-4386 Based on the activityHandler logic that is documented the conversation state needs to be saved before calling a skill so activity generated by skill will have access to current state. Could you check if this helps by adding appropriate calls and checking the response status from the skill invocation?


0 Votes 0 ·

Thank you @romungi-MSFT for your response. We are saving the current state before the skill invocation as follows:

 await _conversationState.SaveChangesAsync(turnContext, force: true, cancellationToken: cancellationToken);

So this shouldn't be the problem. We think this is something related with Alexa itself, as with Telegram or the Emulator, is working as expected. Meaning, receiving the messages from the Skill.

I know this is a very specific issue, as maybe is not that common using consumer / skill logic + Alexa as channel, but maybe someone already faced this issue. If we don't find a solution soon, we will need to think about breaking up this logic, and concentrate it all in just one bot.

Thanks!

1 Vote 1 ·

0 Answers