2025年3月3日 星期一

[筆記][LINEBOT]訊息事件類別event type

參考:
  • https://developers.line.biz/en/docs/messaging-api/
  • ReceivedMessage.events[0].type
  • event.message.type


主要事件類型:
  • message - 使用者傳送訊息(文字、圖片、影片等)。
  • follow - 使用者加為好友或解除封鎖後再次加回。
  • unfollow - 使用者封鎖機器人。
  • join - 機器人被加入群組或聊天室。
  • leave - 機器人被移出群組或聊天室。
  • memberJoined - 有新成員加入群組或聊天室。
  • memberLeft - 有成員離開群組或聊天室。
  • postback - 使用者點擊 Postback Action 按鈕(會附帶 postback.data)。
  • beacon - 使用者進入 Beacon(LINE Beacon 訊號)。
  • accountLink - 使用者點擊 LINE Login 並綁定帳號。
  • things - 來自 LINE Things (IoT 相關) 的事件。

message 事件的子類型:
當 type 為 message 時,還會有 message.type 來指定訊息種類,例如:
  • text - 文字訊息
  • image - 圖片訊息
  • video - 影片訊息
  • audio - 音訊訊息
  • file - 檔案訊息
  • location - 位置訊息
  • sticker - 貼圖訊息