static FacebookRequestMessage CreatePostbackMessage(FacebookPostback postback)
 {
     return(new FacebookRequestMessage
     {
         Entries = new[]
         {
             new FacebookEntry
             {
                 Messaging = new []
                 {
                     new FacebookInboundMessaging
                     {
                         Sender = new FacebookAccount
                         {
                             Id = "1"
                         },
                         Recipient = new FacebookAccount
                         {
                             Id = "2"
                         },
                         Postback = postback
                     }
                 }
             }
         }
     });
 }
        public void CanConververPostackPayload()
        {
            var fbMessage = new FacebookPostback
            {
                Payload = "Postback Value"
            };

            var activities = CreatePostbackMessage(fbMessage).ToMessageActivities().ToList();

            Assert.Equal(1, activities.Count);
            Assert.Equal("Postback Value", activities[0].Text);
        }
Beispiel #3
0
        protected virtual async Task OnFacebookPostBack(ITurnContext turnContext, FacebookPostback postBack, CancellationToken cancellationToken)
        {
            Logger.LogInformation("PostBack message received.");

            // TODO: Your PostBack handling logic here...

            // Answer the postback, and show choices
            var reply = MessageFactory.Text("Are you sure?");
            await turnContext.SendActivityAsync(reply, cancellationToken);

            await ShowChoices(turnContext, cancellationToken);
        }
Beispiel #4
0
 private void OnFacebookPostBack(FacebookPostback postBack)
 {
     // TODO: Your PostBack handling logic here...
 }