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.
57 lines
1.9 KiB
57 lines
1.9 KiB
以GroupID=202061134174478為例子
|
|
***一定要是admin才能發文
|
|
|
|
0.『上線』前需要申請權限
|
|
應用程式權限:【groups-api】、【publish_to_groups】、【groups_access_member_info】
|
|
Messenger權限:【page_messaging】
|
|
延長權杖:https://developers.facebook.com/tools/debug/accesstoken/
|
|
|
|
|
|
1.PO文與讀取內容
|
|
|
|
1.1在社團發佈一則貼文"I love this Group",再結尾會出現OO(由應用程式發布)
|
|
|
|
1.1.0【需要publish_to_groups權限,才能用應用程式發布訊息】,【admin】
|
|
1.1.1.Request:取得
|
|
https://developers.facebook.com/tools/explorer/?method=POST&path=202061134174478%2Ffeed&version=v7.0&message=I%20love%20this%20Group
|
|
1.1.2.Response:PO回覆的ID(GroupID-POSTID),
|
|
{ "id": "620899171850629_622045855069294" }
|
|
|
|
==>> { "id": "{GroupID}_{POSTID}" }
|
|
==>> 永久網址 https://www.facebook.com/groups/620899171850629/permalink/621318175142062/
|
|
==>> 可以透過1.2取得留言內容
|
|
|
|
1.2取得貼文內容
|
|
|
|
1.2.0【需要groups_access_member_info權限,才能顯示ID】,【user】【admin】
|
|
1.2.1 Request:取得
|
|
https://developers.facebook.com/tools/explorer/?method=GET&path=202061134174478_205484600498798%3Ffields%3Dcomments&version=v7.0
|
|
1.2.2.Response:from這個是facebook登入顯示的id、name
|
|
{
|
|
"comments": {
|
|
"data": [
|
|
{
|
|
"created_time": "2020-06-10T08:58:24+0000",
|
|
"from": {
|
|
"name": "Yh Liu",
|
|
"id": "569972750560974"
|
|
},
|
|
"message": "love +1",
|
|
"id": "205485577165367"
|
|
}
|
|
],
|
|
"paging": {
|
|
"cursors": {
|
|
"before": "WTI5dGJXVnVkRjlqZAFhKemIzSTZANakExTkRnMU5UYzNNVFkxTXpZAM09qRTFPVEUzTnprMU1EUT0ZD",
|
|
"after": "WTI5dGJXVnVkRjlqZAFhKemIzSTZANakExTkRnMU5UYzNNVFkxTXpZAM09qRTFPVEUzTnprMU1EUT0ZD"
|
|
}
|
|
}
|
|
},
|
|
"id": "202061134174478_205484600498798"
|
|
}
|
|
|
|
|
|
2.Messenger JS SDK:
|
|
https://developers.facebook.com/docs/messenger-platform/discovery/send-to-messenger-plugin?locale=zh_TW
|
|
|
|
3.點選send to messenger就可以取得psid
|