Exemplo n.º 1
0
        /// <summary>
        /// Send Message using Send API
        /// </summary>
        /// <param name="message"></param>
        /// <param name="messagingType"></param>
        /// <returns></returns>
        private dynamic SendText(string th, string en, string messagingType = "RESPONSE", params QuickReply[] quickreplies)
        {
            var text = "";

            if (this.SessionData.lang == "en")
            {
                text = en + " \n\n#wan";
            }
            else if (this.SessionData.lang == "th")
            {
                text = th + "\n\n#น้องวัน";
            }
            else
            {
                // send both
                text = th + "\n\n" + en +
                       "\n\n#น้องวัน #wan";
            }

            object message;

            if (quickreplies.Length > 0)
            {
                message = new
                {
                    text          = text,
                    quick_replies = quickreplies
                };
            }
            else
            {
                message = new
                {
                    text = text,
                };
            }

            return(FM.FacebookApiPost(this.sitesettings,
                                      "/me/messages",
                                      new
            {
                recipient = new { id = this.PageScopedId },
                messaging_type = messagingType,
                message = message
            }, false));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Send Message using Send API
 /// </summary>
 /// <param name="message"></param>
 /// <param name="messagingType"></param>
 /// <returns></returns>
 private dynamic SendImage(string image, string messagingType = "RESPONSE", params QuickReply[] quickreplies)
 {
     return(FM.FacebookApiPost(this.sitesettings,
                               "/me/messages",
                               new
     {
         recipient = new { id = this.PageScopedId },
         messaging_type = messagingType,
         message = new
         {
             attachment = new
             {
                 type = "image",
                 payload = new
                 {
                     url = image,
                     is_reusable = true
                 }
             }
         },
         quick_replies = quickreplies
     }));
 }