basic Line bot WebHook
public class LineChatController : ApiController
{
[HttpPost]
public IHttpActionResult POST()
{
string ChannelAccessToken = "3muq--------請用你自己的---------nyilFU=";
try
{
//取得 http Post RawData(should be JSON)
string postData = Request.Content.ReadAsStringAsync().Result;
//剖析JSON
var ReceivedMessage = isRock.LineBot.Utility.Parsing(postData);
//回覆訊息
string Message;
Message = "你說了:" + ReceivedMessage.events[0].message.text;
//回覆用戶
isRock.LineBot.Utility.ReplyMessage(ReceivedMessage.events[0].replyToken, Message, ChannelAccessToken);
//回覆API OK
return Ok();
}
catch (Exception ex)
{
return Ok();
}
}
}