-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User response from button selection on Adaptive card not working on Facebook Messenger #6632
Comments
Hi @nouman937, Let's try to isolate this issue to find the root cause of this problem. Is this issue reproducible without omnichannel? |
Hi,
We haven't tried it without Omnichannel as it will require further
configurations and development.
…On Sun, 21 Jan 2024, 5:02 am Ram Page, ***@***.***> wrote:
Hi @nouman937 <https://github.com/nouman937>,
Let's try to isolate this issue to find the root cause of this problem.
Is this issue reproducible without omnichannel?
—
Reply to this email directly, view it on GitHub
<#6632 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BCPWAN2RYMNYIVFG6WMEJWLYPRLK7AVCNFSM6AAAAABCDICKV2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGQ2TEMRXGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi @nouman937, I can look into this. |
Hi @nouman937, I isolated this issue from omnichannel and was not able to repro. The I modified the 02.echo-bot sample to send the adaptive card like this: protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
{
var receivedText = turnContext.Activity.Text?.ToLower();
if (receivedText == "card")
{
await SendAdaptiveCardAsync(turnContext, cancellationToken);
}
else
{
var replyText = $"Echo: {turnContext.Activity.Text}";
await turnContext.SendActivityAsync(MessageFactory.Text(replyText, replyText), cancellationToken);
}
}
private async Task SendAdaptiveCardAsync(ITurnContext turnContext, CancellationToken cancellationToken)
{
var card = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
{
Actions = new List<AdaptiveAction>
{
new AdaptiveSubmitAction
{
Title = "Option 1",
Data = "option1"
},
new AdaptiveSubmitAction
{
Title = "Option 2",
Data = "option2"
}
}
};
var attachment = new Attachment
{
ContentType = AdaptiveCard.ContentType,
Content = JObject.FromObject(card)
};
var response = MessageFactory.Attachment(attachment);
await turnContext.SendActivityAsync(response, cancellationToken);
} Demo: Screen.Recording.2024-02-09.at.3.38.27.PM.movDocumentation followed: Attached is the tested bot sample: |
We are using Azure bot framework that is connected to Omnichannel solution. Customer connects to Facebook messenger it gets routed to Omnichannel and then omnichannel routes the conversation to Azure bot as an agent.
Bot is asking customer to select an option using adaptive card which is being used as CardActivity and sent to customer using ChoicePrompt as can be seen in the code below. Based on the option select, We are performing further action like initiating a chat with actual agent in omnichannel.
The issue is that when customer select an option from adaptive card on Facebook, the "OnMessageActivityAsync" is not getting triggered in our DialogBot class and hence we are not able to find out what the customer has selected. This functionality is working fine on bot emulator but not on Facebook as can be seen in snapshots
To Reproduce
Expected behavior
When user selects an option, the OnMessageActivityAsync should be triggered with user input response
##Code for Adaptive Card
List stepList_AR = new List();
stepList_AR.Add(LanguageModel.Talk_to_agent_AR);////Adding only one step in List
//Card Activity
Cardactivity = MessageFactory.Attachment(new Attachment
{
ContentType = AdaptiveCard.ContentType,
// Convert the AdaptiveCard to a JObject
Content = JObject.FromObject(card),
});
return await stepContext.PromptAsync(nameof(ChoicePrompt), new PromptOptions
{
Prompt = (Activity)Cardactivity,
Choices = ChoiceFactory.ToChoices(stepList),
// Don't render the choices outside the card
Style = ListStyle.None,
},
cancellationToken);
Screenshots
Attached
The text was updated successfully, but these errors were encountered: