You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

65 lines
3.2 KiB

1.要求messenger權限
https://developers.facebook.com/docs/messenger-platform/webview/permissions
延長token
https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id={應用程式編號}&client_secret={應用程式密碼}&fb_exchange_token={短暫token}
1.建立
1.1.首次請user對話=>取得senderId、再取得資訊,紀錄是誰:https://developers.facebook.com/docs/messenger-platform/identity/user-profile
1.1.1 SDK install:https://developers.facebook.com/docs/messenger-platform/webview/extensions?locale=zh_TW
1.2.授權login時後,也順便取得name email
1.2.5衝突時候,人工分配
2.PO紀錄
2.1 admin發文:
2.1.1 http://localhost:3000/Groups?hub.verify_token=LG8YBDVaU0Wg47n7VUns66666g&hub.mode=subscribe&message={貼文內容}
2.2 user留言:到社團手動留言。
2.3 擷取POST comment 內的ID
2.4 進行broadcast: ID => messager senderID(PSID)
2.4.1使用者資料:http://localhost:3000/webhook?hub.verify_token=LG8YBDVaU0Wg47n7VUns66666g&hub.challenge=CHALLENGE_ACCEPTED&hub.mode=subscribe&getRecords=true
2.4.2傳遞訊息:http://localhost:3000/webhook?hub.verify_token=LG8YBDVaU0Wg47n7VUns66666g&hub.mode=subscribe&fullname={firstName}%20{latName}&reply={reply}
// 如找不到使用者id可利用此API(會找到目前所有給予授權的使用者) // 圖形API測試工具
https://graph.facebook.com/v7.0/{group-id}/conversations?fields=senders
ex:
// Duck團購
https://graph.facebook.com/v7.0/108355484239143/conversations?fields=senders&access_token=EAAJRQcUfZCWIBAH8rZCm8dPcrGlbtGZCIAMu4D1DBrEbFZC7wX8hXZBpR2blXdOJYlydG3Kn964yVPToM3JtEvZCkMkcENQ7hw8eoALZAAsG2rLsNGJHlYIfw0pZBLFS1m6D4oE1gPMZCamlTIZBEgDoqkMB90nPSC2Rnvyt2MdnxZCKS9wsHzM1mVl5VG3IZBc1QXfroXPHY7zanQZDZD
------------------
SP:
1.上傳照片
1.1 API:https://developers.facebook.com/docs/graph-api/reference/group/photos/#Creating
1.2 Sample:https://developers.facebook.com/tools/explorer/?method=POST&path=202061134174478%2Fphotos&version=v7.0&url=https%3A%2F%2Fi0.wp.com%2Fskyline.tw%2Fimages%2Factivity%2Fimage_logo%2F2019%2F09%2F2033-16155512-uote67shv0t47wgl81wis2rha01c9yc8t6q4.jpg%3Fresize%3D1080%252C720
*圖片+文字
https://graph.facebook.com/v7.0/202061134174478/photos?url=https%3A%2F%2Fi0.wp.com%2Fskyline.tw%2Fimages%2Factivity%2Fimage_logo%2F2019%2F09%2F2033-16155512-uote67shv0t47wgl81wis2rha01c9yc8t6q4.jpg%3Fresize%3D1080%252C720&message=adsdsa&access_token=EAAEPi7Bp2A0BADZCuFqwZBVpugMiaXDTHkXDofRLjkHOFRovLo2tiPSwZBwaP92bo6AEvJV9ZAZBPHfzQiuclBaKjxO6HBZBrDxqdreFbZCJ51XOCvgqXXpR7r2dAzeDtVmUbA1j47vBJi1asIR6VNgHcZCUhcGJcoowYA0BpjIsFvKMuzddslENJXqz0fld4YHhOTaNuqZBBqwZDZD
*多圖片+文字
// 先上傳圖片
post
https://graph.facebook.com/v7.0/202061134174478/photos?
{
"url": "",
"published":false -- 不公開
}
回傳{id:""}
//在上傳文字加圖片
https://graph.facebook.com/v7.0/202061134174478/feed
{
"attached_media[0]":{"media_fbid":"圖片ID"},
"attached_media[1]":{"media_fbid":"圖片ID"},
"caption":"123sad"
}
2.上傳影片
Untest:
https://developers.facebook.com/docs/graph-api/video-uploads/
-- 會只能傳影片 無法傳影片加圖片
1.帳號密碼登入 or FB(ask => user token => callApi)
2.1user綁定 -授權msg、Groups 內容
2.2Admin綁定-授權msg、Groups(more)
3.ACtions:POST、擷取紀錄、SEND