Skip to content

Instantly share code, notes, and snippets.

Last active Mar 28, 2020
What would you like to do?
//This action is called by the Power Automate
public async Task<IActionResult> PostReview(string activityId, string botId, string conversationId, string serviceUrl, string userId, string channelId, string botName)
var convRef = new ConversationReference();
//Revive the conversation reference
convRef.ActivityId = activityId;
convRef.Bot = new ChannelAccount { Id = botId, Name = botName };
convRef.ChannelId = channelId;
convRef.Conversation = new ConversationAccount { Id = conversationId };
convRef.ServiceUrl = serviceUrl;
convRef.User = new ChannelAccount { Id = userId };
//Send the message to the customer using the Conversation Reference
await ((BotAdapter)_adapter).ContinueConversationAsync(_appId, convRef, BotCalbackPostReview, default(CancellationToken));
// Let the caller know proactive messages have been sent
return new ContentResult()
Content = "<html><body><h1>Proactive messages have been sent.</h1></body></html>",
ContentType = "text/html",
StatusCode = (int)HttpStatusCode.OK,
private async Task BotCalbackPostReview(ITurnContext turnContext, CancellationToken cancellationToken)
var reply = MessageFactory.Text("Would you like to share your experience?");
//Providing a few suggested actions to choreograph the customer's move.
reply.SuggestedActions = new SuggestedActions()
Actions = new List<CardAction>()
new CardAction() { Title = "Review Experience", Type = ActionTypes.ImBack, Value = "I'd like to review my experience" },
new CardAction() { Title = "I'll do it later", Type = ActionTypes.ImBack, Value = "I'll do it later" },
await turnContext.SendActivityAsync(reply, cancellationToken);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment