public FacebookMessageQuickReply GetTemplate()
        {
            var facebookMessage = new FacebookMessageQuickReply();

            var newListQuickReply = new FacebookQuickReply
            {
                Content_type = "text",
                Title        = "Nuova lista",
                Payload      = "Nuova lista"
            };

            var oldListQuickReply = new FacebookQuickReply
            {
                Content_type = "text",
                Title        = "Vecchia lista",
                Payload      = "Vecchia lista"
            };

            facebookMessage.Quick_replies = new FacebookQuickReply[]
            {
                newListQuickReply,
                oldListQuickReply
            };

            facebookMessage.Text = _message;

            return(facebookMessage);
        }
Esempio n. 2
0
        public FacebookMessageQuickReply GetTemplate()
        {
            var facebookMessage = new FacebookMessageQuickReply();

            var yesQuickReply = new FacebookQuickReply
            {
                Content_type = "text",
                Title        = CardMessagesResource.YesOrNoCardYesTitle,
                Payload      = CardMessagesResource.YesOrNoCardYesPayload
            };

            var noQuickReply = new FacebookQuickReply
            {
                Content_type = "text",
                Title        = CardMessagesResource.YesOrNoCardNoTitle,
                Payload      = CardMessagesResource.YesOrNoCardNoPayload
            };

            facebookMessage.Quick_replies = new FacebookQuickReply[]
            {
                yesQuickReply,
                noQuickReply
            };

            facebookMessage.Text = _message;

            return(facebookMessage);
        }
Esempio n. 3
0
        protected virtual async Task OnFacebookQuickReply(ITurnContext turnContext, FacebookQuickReply quickReply, CancellationToken cancellationToken)
        {
            Logger.LogInformation("QuickReply message received.");

            // TODO: Your quick reply event handling logic here...

            // Process the message by checking the Activity.Text.  The FacebookQuickReply could also contain a json payload.

            // Initially the bot offers to showcase 3 Facebook features: Quick replies, PostBack and getting the Facebook Page Name.
            switch (turnContext.Activity.Text)
            {
            // Here we showcase how to obtain the Facebook page id.
            // This can be useful for the Facebook multi-page support provided by the Bot Framework.
            // The Facebook page id from which the message comes from is in turnContext.Activity.Recipient.Id.
            case FacebookPageIdOption:
            {
                var reply = MessageFactory.Text($"This message comes from the following Facebook Page: {turnContext.Activity.Recipient.Id}");
                await turnContext.SendActivityAsync(reply, cancellationToken);
                await ShowChoices(turnContext, cancellationToken);

                break;
            }

            // Here we send a HeroCard with 2 options that will trigger a Facebook PostBack.
            case PostBackOption:
            {
                var card = new HeroCard
                {
                    Text    = "Is 42 the answer to the ultimate question of Life, the Universe, and Everything?",
                    Buttons = new List <CardAction>
                    {
                        new CardAction()
                        {
                            Title = "Yes", Type = ActionTypes.PostBack, Value = "Yes"
                        },
                        new CardAction()
                        {
                            Title = "No", Type = ActionTypes.PostBack, Value = "No"
                        },
                    },
                };

                var reply = MessageFactory.Attachment(card.ToAttachment());
                await turnContext.SendActivityAsync(reply, cancellationToken);

                break;
            }

            // By default we offer the users different actions that the bot supports, through quick replies.
            case QuickRepliesOption:
            default:
            {
                await ShowChoices(turnContext, cancellationToken);

                break;
            }
            }
        }
        public FacebookMessageQuickReply GetTemplate()
        {
            var facebookMessage = new FacebookMessageQuickReply();

            var timeTableQuickReply = new FacebookQuickReply
            {
                Content_type = "text",
                Title        = CardMessagesResource.GreetingCardTimeTableTitle,
                Payload      = CardMessagesResource.GreetingCardTimeTablePayload
            };

            var viewPromoQuickReply = new FacebookQuickReply
            {
                Content_type = "text",
                Title        = CardMessagesResource.GreetingCardViewPromoTitle,
                Payload      = CardMessagesResource.GreetingCardViewPromoPayload
            };

            var newListQuickReply = new FacebookQuickReply
            {
                Content_type = "text",
                Title        = CardMessagesResource.GreetingCardNewListTitle,
                Payload      = CardMessagesResource.GreetingCardNewListPayload
            };

            var oldListQuickReply = new FacebookQuickReply
            {
                Content_type = "text",
                Title        = CardMessagesResource.GreetingCardOldListTitle,
                Payload      = CardMessagesResource.GreetingCardOldListPayload
            };

            facebookMessage.Quick_replies = new FacebookQuickReply[]
            {
                newListQuickReply,
                oldListQuickReply,
                viewPromoQuickReply,
                timeTableQuickReply,
            };

            facebookMessage.Text = _message;

            return(facebookMessage);
        }
Esempio n. 5
0
        public async virtual Task createQuickReplay(IDialogContext context)
        {
            //     await writeMessageToUser(context, new string[] { title });

            var reply        = context.MakeMessage();
            var channelData  = new JObject();
            var quickReplies = new JArray();
            var qrList       = new List <FacebookQuickReply>();

            foreach (var s in options)
            {
                var r = new FacebookQuickReply("text", s, s);
                qrList.Add(r);
            }
            var message = new FacebookMessage(prompt, qrList);

            reply.ChannelData = message;
            await context.PostAsync(reply);

            updateRequestTime(context);
            context.Wait(optionsRes);
        }
Esempio n. 6
0
 private void OnFacebookQuickReply(FacebookQuickReply quickReply)
 {
     // TODO: Your quick reply event handling logic here...
 }