-
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
![Emulator](https://private-user-images.githubusercontent.com/144662583/298290692-25a203ed-a547-41c8-b1d7-a3c589771b04.PNG?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1NDg4NDIsIm5iZiI6MTcyNTU0ODU0MiwicGF0aCI6Ii8xNDQ2NjI1ODMvMjk4MjkwNjkyLTI1YTIwM2VkLWE1NDctNDFjOC1iMWQ3LWEzYzU4OTc3MWIwNC5QTkc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQ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Y3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.XWGkSVEaJf9beibaMlKg43eBHIItwac77dI_6E5sELU)
{
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: