コード例 #1
0
        private object Text(string to, string text)
        {
            var request = new RequestSendPushMessage()
            {
                To       = to,
                Messages = new List <TextMessage>
                {
                    new TextMessage {
                        Text = text, Type = "text"
                    }
                }
            };

            return(request);
        }
コード例 #2
0
        private object Card(string to, Card card)
        {
            var request = new RequestSendPushMessage <RequestTemplate <Card> >()
            {
                To       = to,
                Messages = new List <RequestTemplate <Card> >
                {
                    new RequestTemplate <Card>
                    {
                        Type     = "template",
                        AltText  = "This is a buttons template",
                        Template = card
                    }
                }
            };

            return(request);
        }
コード例 #3
0
        private object Carousel(string to)
        {
            var request = new RequestSendPushMessage <RequestTemplate <Carousel> >()
            {
                To       = to,
                Messages = new List <RequestTemplate <Carousel> >
                {
                    new RequestTemplate <Carousel>
                    {
                        Type     = "template",
                        AltText  = "This is a buttons template",
                        Template = new Carousel
                        {
                            Type  = "carousel",
                            Cards = new List <CardBasis>
                            {
                                new Card
                                {
                                    Type = "buttons",
                                    ThumbnailImageUrl    = "https://example.com/bot/images/image.jpg",
                                    ImageAspectRatio     = "rectangle",
                                    ImageSize            = "cover",
                                    ImageBackgroundColor = "#FFFFFF",
                                    Title = "Menu",
                                    Text  = "Please select",
                                    //DefaultAction = new ButtonAction
                                    //{
                                    //    Type = "uri",
                                    //    Label = "label",
                                    //    Uri = "http://example.com/page/123"
                                    //},
                                    Actions = new List <ButtonAction>
                                    {
                                        new ButtonAction
                                        {
                                            Type  = "uri",
                                            Label = "label",
                                            Uri   = "http://example.com/page/123"
                                        },
                                        new ButtonAction
                                        {
                                            Type  = "postback",
                                            Label = "postBack",
                                            Data  = "action=add&itemid=123"
                                        }
                                    }
                                },
                                new Card
                                {
                                    Type = "buttons",
                                    ThumbnailImageUrl    = "https://example.com/bot/images/image.jpg",
                                    ImageAspectRatio     = "rectangle",
                                    ImageSize            = "cover",
                                    ImageBackgroundColor = "#FFFFFF",
                                    Title = "Menu",
                                    Text  = "Please select",
                                    //DefaultAction = new ButtonAction
                                    //{
                                    //    Type = "uri",
                                    //    Label = "label",
                                    //    Uri = "http://example.com/page/123"
                                    //},
                                    Actions = new List <ButtonAction>
                                    {
                                        new ButtonAction
                                        {
                                            Type  = "uri",
                                            Label = "label",
                                            Uri   = "http://example.com/page/123"
                                        },
                                        new ButtonAction
                                        {
                                            Type  = "postback",
                                            Label = "postBack",
                                            Data  = "action=add&itemid=123"
                                        }
                                    }
                                }
                            },
                            ImageAspectRatio = "rectangle",
                            ImageSize        = "cover"
                        }
                    }
                }
            };

            return(request);
        }