close

文章開頭我先聲名 基本上跟BOTFRAMEWORK那個平台沒關係 我要用的是他的API的CODE而已

    

申請個BOT.png網址.png

 

 

 

 

secret.png下面還有webhook跟Token 這兩個重頭戲 請原諒我沒拍圖上來

乖乖去寫腦子.png

參考文件.png

簡單的說
   申請一個line Bot後 會有密碼 跟Token 他還要有一個WEBHOOK進行溝通,也就是API  但是這個API偏偏就是沒有C# 有一堆什麼JAVA PYTHON PHP都有了 擺明就是給LINUX ,
所以我就用微軟的BOT FRAMEWORK起了一個API 他預設是給我API/MESSAGE的路徑去打給BOTFRAMEWORK 所以我額外開了一條路是API/LINE的CONTROLLER讓LINE可以來呼叫我的程式 ,我再透過這個地方去改打LUIS或是其他地方的服務,或是拉回到我本身的SERVICE,在透過replyModel去,這個跟FB的範本極度類似 都是做好範本丟過去

 

最後這一頁就文章化

 

https://console.api.ai/api-client/#/agent/1f6f5576-db73-4aa7-8f42-8009ba226660/integrations(API.AI的前面步驟教我怎麼開個LINE 恩 但是就只有這樣了 )
https://developers.line.me/messaging-api/getting-started#apply_messagingapi  (LINE開發文件 衝阿!)
https://devdocs.line.me/en/#webhooks(Line
的連線機制)
https://devdocs.line.me/en/#webhook-event-object

http://studyhost.blogspot.tw/2016/05/linebot-1-clinebot.html(董大大的文章 (但是已經失效了 看看就好))
http://studyhost.blogspot.tw/search/label/LineBot (董大大的文章 (但是已經失效了 看看就好))
https://developers.line.me/bot-api/overview(Line
API文件)

最有用的東西就這個了

https://github.com/eternaltung/LineBot-WebAPI/tree/master/LineBot/Controllers
(靠這個寫就對了)




同場加映 LINEBOT回傳的字串形式

 

文字


  "replyToken": "922618877b49409991f7056f86e558c6", 
  "type": "message", 
  "timestamp": 1481159854942, 
  "source": { 
    "type": "user", 
    "userId": "U7756bbb79652fd4f5dbf9f2a91baa3eb" 
  }, 
  "message": { 
    "id": "5317314986100", 
    "type": "text", 
    "text": "早安", 
    "latitude": 0.0, 
    "longitude": 0.0 
  } 
}


圖片


  "replyToken": "29c9b9fee4b244029df529edd3e74d39", 
  "type": "message", 
  "timestamp": 1481159887324, 
  "source": { 
    "type": "user", 
    "userId": "U7756bbb79652fd4f5dbf9f2a91baa3eb" 
  }, 
  "message": { 
    "id": "5317316501186", 
    "type": "image", 
    "latitude": 0.0, 
    "longitude": 0.0 
  } 
}

  "replyToken": "1fa5487fe6bd4ec793831a01b5a5a93c", 
  "type": "message", 
  "timestamp": 1481159911459, 
  "source": { 
    "type": "user", 
    "userId": "U7756bbb79652fd4f5dbf9f2a91baa3eb" 
  }, 
  "message": { 
    "id": "5317317625886", 
    "type": "image", 
    "latitude": 0.0, 
    "longitude": 0.0 
  } 
}

貼圖

  "replyToken": "8b8cce23020d47899d6a63632b56a818", 
  "type": "message", 
  "timestamp": 1481159976871, 
  "source": { 
    "type": "user", 
    "userId": "U7756bbb79652fd4f5dbf9f2a91baa3eb" 
  }, 
  "message": { 
    "id": "5317320685986", 
    "type": "sticker", 
    "latitude": 0.0, 
    "longitude": 0.0, 
    "packageId": "1", 
    "stickerId": "4" 
  } 
}

  "replyToken": "4687e11bb8d74c55a9d1992f72153959", 
  "type": "message", 
  "timestamp": 1481160036018, 
  "source": { 
    "type": "user", 
    "userId": "U7756bbb79652fd4f5dbf9f2a91baa3eb" 
  }, 
  "message": { 
    "id": "5317323462245", 
    "type": "sticker", 
    "latitude": 0.0, 
    "longitude": 0.0, 
    "packageId": "2", 
    "stickerId": "141" 
  } 
}

地址

  "replyToken": "b800d9e9d9da4df9a584fbf511744828", 
  "type": "message", 
  "timestamp": 1481160071257, 
  "source": { 
    "type": "user", 
    "userId": "U7756bbb79652fd4f5dbf9f2a91baa3eb" 
  }, 
  "message": { 
    "id": "5317325122992", 
    "type": "location", 
    "title": "位置訊息", 
    "address": "106台灣台北市大安區敦化南路二段218號", 
    "latitude": 25.021618, 
    "longitude": 121.548106 
  } 
}

  "replyToken": "05a15ac1bdc246638213fc697b442c19", 
  "type": "message", 
  "timestamp": 1481160120296, 
  "source": { 
    "type": "user", 
    "userId": "U7756bbb79652fd4f5dbf9f2a91baa3eb" 
  }, 
  "message": { 
    "id": "5317327429827", 
    "type": "location", 
    "title": "位置訊息", 
    "address": "110台灣台北市信義區忠孝東路四段345巷4弄8號", 
    "latitude": 25.042615, 
    "longitude": 121.559719 
  } 
}
語音


  "replyToken": "0f4a9c77a0f042ac9c19e516435cf2d7", 
  "type": "message", 
  "timestamp": 1481160177713, 
  "source": { 
    "type": "user", 
    "userId": "U7756bbb79652fd4f5dbf9f2a91baa3eb" 
  }, 
  "message": { 
    "id": "5317330140224", 
    "type": "audio", 
    "latitude": 0.0, 
    "longitude": 0.0 
  } 
}

  "replyToken": "ba65c29d9dd847079def030fdaf29550", 
  "type": "message", 
  "timestamp": 1481160222478, 
  "source": { 
    "type": "user", 
    "userId": "U7756bbb79652fd4f5dbf9f2a91baa3eb" 
  }, 
  "message": { 
    "id": "5317332249031", 
    "type": "audio", 
    "latitude": 0.0, 
    "longitude": 0.0 
  } 
}

影片


  "replyToken": "e87c4b1aba884c82b653228a9453e3e6", 
  "type": "message", 
  "timestamp": 1481160260486, 
  "source": { 
    "type": "user", 
    "userId": "U7756bbb79652fd4f5dbf9f2a91baa3eb" 
  }, 
  "message": { 
    "id": "5317334052123", 
    "type": "video", 
    "latitude": 0.0, 
    "longitude": 0.0 
  } 
}

arrow
arrow
    創作者介紹
    創作者 丁滿 的頭像
    丁滿

    小丁的部落格

    丁滿 發表在 痞客邦 留言(0) 人氣()