---
# System prepended metadata

title: 粉絲專頁相關功能實驗
tags: [developer, facebook, page]

---

# 粉絲專頁相關功能實驗

###### tags: `facebook` `page` `developer`

## 取得粉專動態的留言

### curl

```
curl -i -X GET \
	"https://graph.facebook.com/v7.0/113977140360460/feed?fields=comments%7Bcan_reply_privately%2Cfrom%2Cid%2Cmessage%7D%2Cfrom%2Cmessage%2Cattachments%7Bmedia_type%2Cmedia%2Ctype%7D%2Cstatus_type%2Cupdated_time&access_token=<access token sanitized>"
```

### GET Parameters

```
{
	"fields": "comments{can_reply_privately,from,id,message},from,message,attachments{media_type,media,type},status_type,updated_time"
}
```

### Response

```
{
	"data": [
		{
			"comments": {
				"data": [
					{
						"can_reply_privately": false,
						"from": {
							"name": "Jkfans 直播",
							"id": "113977140360460"
						},
						"id": "223522465350939_223528845350301",
						"message": "麻煩大家留個言 謝謝"
					},
					{
						"can_reply_privately": true,
						"id": "223522465350939_223529645350221",
						"message": "言"
					},
					{
						"can_reply_privately": true,
						"id": "223522465350939_223529728683546",
						"message": "123"
					},
					{
						"can_reply_privately": false,
						"from": {
							"name": "Jkfans 直播",
							"id": "113977140360460"
						},
						"id": "223522465350939_223529878683531",
						"message": "感恩(回覆功能測試)"
					},
					{
						"can_reply_privately": true,
						"from": {
							"name": "史約翰",
							"id": "3675243985824577"
						},
						"id": "223522465350939_223531808683338",
						"message": "不用粉專管理員身份留言"
					},
					{
						"can_reply_privately": true,
						"from": {
							"name": "Ailia Lee",
							"id": "2995496363903590"
						},
						"id": "223522465350939_223539925349193",
						"message": "唷"
					},
					{
						"can_reply_privately": false,
						"from": {
							"name": "Jkfans 直播",
							"id": "113977140360460"
						},
						"id": "223522465350939_223546432015209",
						"message": "圖形API留言"
					}
				],
				"paging": {
					"cursors": {
						"before": "WTI5dGJXVnVkRjlqZAFhKemIzSTZANakl6TlRJNE9EUTFNelV3TXpBeE9qRTFPVFF6TmpRMk1EUT0ZD",
						"after": "WTI5dGJXVnVkRjlqZAFhKemIzSTZANakl6TlRRMk5ETXlNREUxTWpBNU9qRTFPVFF6TmpZANU5qRT0ZD"
					}
				}
			},
			"from": {
				"name": "Jkfans 直播",
				"id": "113977140360460"
			},
			"message": "點按可新增說明",
			"attachments": {
				"data": [
					{
						"media_type": "video",
						"media": {
							"image": {
								"height": 720,
								"src": "https://scontent.fkhh1-2.fna.fbcdn.net/v/t15.5256-10/s720x720/107594205_223523462017506_8958110695103266928_n.jpg?_nc_cat=109&_nc_sid=ad6a45&_nc_oc=AQntBwMtAdyypYExxJHLVEwRWaQWXGUoYi24F-02vEvy1J3zm-09jN6AnhpChMZakAE&_nc_ht=scontent.fkhh1-2.fna&oh=bb0705ba6b08f164356fdc70ab4412a4&oe=5F2D8250",
								"width": 405
							},
							"source": "https://video.fkhh1-2.fna.fbcdn.net/hvideo-atn-prn/_nc_cat-104/v/rIqgdqiwaKyxcUR1Bf8mU/live-dash/dash-abr3/123717159386458.mpd?_nc_rl=AfDkA3UXfnOH48AY&cbk=dash_www_alltiers_0626a&ms=m_CN&oh=6be8b86ce9d8d907930b4f01024a02c7&oe=5F09A31A"
						},
						"type": "video_inline"
					}
				]
			},
			"status_type": "added_video",
			"updated_time": "2020-07-10T07:42:41+0000",
			"id": "113977140360460_223522465350939"
		}
	],
	"paging": "--sanitized--"
}
```

### 心得

* 可主動透過 Graph API 取得直播的留言
* 粉專身份的留言無法回覆
	* 可取得粉專身份(但有啥用)
* 粉絲的留言可回覆
	* 但無法取得粉絲身份
* 粉專管理員的留言可以回覆
	* 可取得管理員身份(但有啥用)
* 非粉專成員的留言可回覆
	* 可取得非粉絲的身份(蛤!?)
* 直播中可透過 Graph API (以粉專身份)留言

## 取得粉專直播的留言

### curl

```
curl -i -X GET \
	"https://graph.facebook.com/v7.0/113977140360460_223522465350939?fields=attachments%2Ccomments%7Bcan_reply_privately%2Ccreated_time%2Cmessage%2Cid%2Cfrom%2Cparent%7D%2Cfrom%2Cid%2Cmessage%2Cstatus_type%2Cstory&access_token=<access token sanitized>"
```

### GET parameters

```
{
	"fields": "attachments,comments{can_reply_privately,created_time,message,id,from,parent},from,id,message,status_type,story"
}
```

### Response

```
{
	"attachments": {
		"data": [
			{
				"media": {
					"image": {
						"height": 640,
						"src": "https://scontent.fkhh1-2.fna.fbcdn.net/v/t15.5256-10/107594205_223523462017506_8958110695103266928_n.jpg?_nc_cat=109&_nc_sid=ad6a45&_nc_oc=AQntBwMtAdyypYExxJHLVEwRWaQWXGUoYi24F-02vEvy1J3zm-09jN6AnhpChMZakAE&_nc_ht=scontent.fkhh1-2.fna&oh=3316d1f8b9f89347998f8e1fada615f0&oe=5F2E132C",
						"width": 360
					},
					"source": "https://video.fkhh1-1.fna.fbcdn.net/v/t42.1790-2/10000000_594618307858719_1422200100332994635_n.mp4?_nc_cat=102&vs=f6d41d2d93a04d3&_nc_vs=HBksFQAYJEdJQ1dtQUFmVVFSZHpSd0NBRXVBMzhOMHE3d1RidjRHQUFBRhUAAsgBABUAGCRHSUNXbUFEMHgtVXEyeU1CQUFhaHhsbkd4MHdEYnY0R0FBQUYVAgLIAQAoRC1pICclcycgLWZiX3VzZV90ZmR0X3N0YXJ0dGltZSAxIC1pICclcycgLWMgY29weSAtbW92ZmxhZ3MgZmFzdHN0YXJ0KwGIEnByb2dyZXNzaXZlX3JlY2lwZQExFQAlABwAABgPMTEzOTc3MTQwMzYwNDYwFuKt%2Fovc0mUVAigCQzMYA2F2MRwXQLto2ZmZmZoYGWRhc2hfbGl2ZV9tZF9mcmFnXzJfdmlkZW8SABgYdmlkZW9zLnZ0cy5jYWxsYmFjay5wcm9kGRwVABWKnwMAKBJWSURFT19WSUVXX1JFUVVFU1QbB4gVb2VtX3RhcmdldF9lbmNvZGVfdGFnBm9lcF9zZBNvZW1fcmVxdWVzdF90aW1lX21zDTE1OTQzNzE2OTc3MzcMb2VtX2NmZ19ydWxlCndhc2xpdmVfc2QTb2VtX3JvaV9yZWFjaF9jb3VudAE3DG9lbV92aWRlb19pZA8yMjM1MjI0NjUzNTA5MzkSb2VtX3ZpZGVvX2Fzc2V0X2lkDzIyMzUyMjQ2MjAxNzYwNhVvZW1fdmlkZW9fcmVzb3VyY2VfaWQPMjIzNTIyNDU4Njg0MjczJQQA&_nc_sid=a6057a&efg=eyJ2ZW5jb2RlX3RhZyI6Im9lcF9zZCJ9&_nc_oc=AQkbyAFDPsv9l_dopVC_zuk77T4XibeFoB0sH9Qd_Rlu1zMxwulA8ELoFpxaiWEOAVo&_nc_ht=video.fkhh1-1.fna&oh=8cd643a7e78aac8f500975d2eacf0581&oe=5F09D13A&_nc_rid=bb692775ac17401"
				},
				"target": {
					"id": "223522465350939",
					"url": "https://www.facebook.com/jkfans.live/videos/223522465350939/"
				},
				"type": "video_inline",
				"url": "https://www.facebook.com/jkfans.live/videos/223522465350939/"
			}
		]
	},
	"comments": {
		"data": [
			{
				"can_reply_privately": true,
				"created_time": "2020-07-10T07:05:13+0000",
				"message": "言",
				"id": "223522465350939_223529645350221"
			},
			{
				"can_reply_privately": true,
				"created_time": "2020-07-10T07:27:43+0000",
				"message": "唷",
				"id": "223522465350939_223539925349193",
				"from": {
					"name": "Ailia Lee",
					"id": "2995496363903590"
				}
			},
			{
				"can_reply_privately": false,
				"created_time": "2020-07-10T08:01:02+0000",
				"message": "圖形API留言回覆",
				"id": "223522465350939_223555698680949",
				"from": {
					"name": "Jkfans 直播",
					"id": "113977140360460"
				}
			},
			{
				"can_reply_privately": false,
				"created_time": "2020-07-10T07:03:24+0000",
				"message": "麻煩大家留個言 謝謝",
				"id": "223522465350939_223528845350301",
				"from": {
					"name": "Jkfans 直播",
					"id": "113977140360460"
				}
			},
			{
				"can_reply_privately": false,
				"created_time": "2020-07-10T07:42:41+0000",
				"message": "圖形API留言",
				"id": "223522465350939_223546432015209",
				"from": {
					"name": "Jkfans 直播",
					"id": "113977140360460"
				}
			},
			{
				"can_reply_privately": false,
				"created_time": "2020-07-10T08:00:29+0000",
				"message": "圖形API留言",
				"id": "223522465350939_223555425347643",
				"from": {
					"name": "Jkfans 直播",
					"id": "113977140360460"
				}
			},
			{
				"can_reply_privately": true,
				"created_time": "2020-07-10T07:05:22+0000",
				"message": "123",
				"id": "223522465350939_223529728683546"
			},
			{
				"can_reply_privately": true,
				"created_time": "2020-07-10T07:10:10+0000",
				"message": "不用粉專管理員身份留言",
				"id": "223522465350939_223531808683338",
				"from": {
					"name": "史約翰",
					"id": "3675243985824577"
				}
			}
		],
		"paging": {
			"cursors": {
				"before": "OAZDZD",
				"after": "MQZDZD"
			}
		}
	},
	"from": {
		"name": "Jkfans 直播",
		"id": "113977140360460"
	},
	"id": "113977140360460_223522465350939",
	"message": "點按可新增說明",
	"status_type": "added_video",
	"story": "Jkfans 直播的直播影片 — 在台南市。",
	"__debug__": {}
}
```

### 心得

## 取得**非粉絲**的身份

### curl

```
curl -i -X GET \
	"https://graph.facebook.com/v7.0/2995496363903590?access_token=<access token sanitized>"
```

### Response

```
{
	"name": "Ailia Lee",
	"id": "2995496363903590"
}
```

### 心得

* 竟然可以拿到非粉專成員的身份
* 但也僅是拿到(粉絲專頁|應用程式)範圍識別身份

## 

### curl

```
curl -i -X POST \
	"https://graph.facebook.com/v7.0/113977140360460_223522465350939/comments?message=%E5%9C%96%E5%BD%A2API%E7%95%99%E8%A8%80%E5%9B%9E%E8%A6%86&parent=223522465350939_223539925349193&access_token=<access token sanitized>"
```

### POST parameters

```
{
	"message": "圖形API留言回覆",
	"parent": "223522465350939_223539925349193"
}
```

### Response

```
{
	"id": "223522465350939_223555698680949"
}
```

### 心得

* 即使官方文件載明無法使用 Graph API 建立留言，但實驗證實還是可行；此功能未來會不會無預警關閉很難說。
* 無法透過 Graph API **回覆**留言。

## 取得某一則留言的詳細資料

### curl

```
curl -i -X GET \
	"https://graph.facebook.com/v7.0/223522465350939_223529728683546?fields=created_time%2Cid%2Cmessage%2Cfrom%2Cobject%2Cparent%2Cprivate_reply_conversation%2Ccomments%2Clikes%2Creactions%2Ccan_reply_privately&access_token=<access token sanitized>"
```

### GET Parameters

```
{
	"fields": "created_time,id,message,from,object,parent,private_reply_conversation,comments,likes,reactions,can_reply_privately"
}
```

### Response

```
{
	"created_time": "2020-07-10T07:05:22+0000",
	"id": "223522465350939_223529728683546",
	"message": "123",
	"object": {
		"description": "點按可新增說明",
		"updated_time": "2020-07-10T06:55:21+0000",
		"id": "223522465350939"
	},
	"comments": {
		"data": [
			{
				"created_time": "2020-07-10T07:05:43+0000",
				"from": {
					"name": "Jkfans 直播",
					"id": "113977140360460"
				},
				"message": "感恩(回覆功能測試)",
				"id": "223522465350939_223529878683531"
			}
		],
		"paging": {
			"cursors": {
				"before": "QVFIUnhWWklMNC15empUZAVY3QnpuOFRPUmt4Nkp5Vk5NbktmSXdfSnU4ekhiaW5ScFpjSmFCSDV3b0RoaE9TNWotOFVRejVDYVJGRWo2cXFLT0UxdDJmbGVn",
				"after": "QVFIUnhWWklMNC15empUZAVY3QnpuOFRPUmt4Nkp5Vk5NbktmSXdfSnU4ekhiaW5ScFpjSmFCSDV3b0RoaE9TNWotOFVRejVDYVJGRWo2cXFLT0UxdDJmbGVn"
			}
		}
	},
	"can_reply_privately": true
}
```

### 心得

* 可以取得回覆的留言

## 取得某一則留言的回覆

### curl

```
curl -i -X GET \
	"https://graph.facebook.com/v7.0/223522465350939_223529728683546/comments?access_token=<access token sanitized>"
```

### Response

```
{
	"data": [
		{
			"created_time": "2020-07-10T07:05:43+0000",
			"from": {
				"name": "Jkfans 直播",
				"id": "113977140360460"
			},
			"message": "感恩(回覆功能測試)",
			"id": "223522465350939_223529878683531"
		}
	],
	"paging": "--sanitized--"
}
```

### 心得

* 這個方式似乎比前一個輕量化，但相關資訊較少。

## 回覆留言

### curl

```
curl -i -X POST \
	"https://graph.facebook.com/v7.0/223522465350939_223539925349193/comments?message=%E5%BE%9E%E3%80%8C%E5%9C%96%E5%BD%A2%20API%20%E6%B8%AC%E8%A9%A6%E5%B7%A5%E5%85%B7%E3%80%8D%E5%9B%9E%E8%A6%86%E7%9C%8B%E7%9C%8B&access_token=<access token sanitized>"
```

### POST Parameters

```
{
	"message": "從「圖形 API 測試工具」回覆看看"
}
```

### Response

```
{
	"id": "223522465350939_223602995342886"
}
```

### 心得

* 官方沒載明可以，但還是可行的。