回复评价,然后编辑或归档回复

查找支持商家回复的评价,发布回复,确认回复已送达发布平台,然后修改措辞或将其归档。

商家回复会以您的名义发布到发布平台。API 会立即接受回复并异步投递,操作顺序为:选择一条可以回复的评价,发布回复,然后重新读取以确认结果。

1. 选择可以回复的评价

列出该地点的评价,并保留 canRespond 为 true 且 responded 为 false 的评价。responseStatus=["PENDING"] 筛选条件会在服务端执行第二项检查;JSON 值必须经过 URL 编码,--data-urlencode 会处理这一步。

Answerable reviews
curl -G "https://listingsapi.com/api/v4/locations/TG9jYXRpb246MTgwMDI4OQ==/reviews" \-H "Authorization: API $LISTINGSAPI_KEY" \--data-urlencode 'responseStatus=["PENDING"]' \--data-urlencode 'first=25'
JSON
{  "node": {    "id": "9e26d2a8-a6ed-42ea-8454-47d1c92ea841",    "source": "maps.google.com",    "rating": 5,    "content": "nice place for family together",    "responded": false,    "responseCount": 0,    "canRespond": true  }}

对于不支持通过 API 接收商家回复的来源,canRespond 为 false。请跳过这些评价;尝试回复也不会送达发布平台。起草回复时,列出评价短语 可让您了解客户最常提及的内容,以便在回复中回应。

2. 发布回复

POST /locations/reviews/respond 直接接收请求体中的字段,无需将其封装在 input 中。interactionId 是评价的 id。respondedWith 为可选字段,用于指定您所使用的回复模板(如有)。

Respond
curl -X POST https://listingsapi.com/api/v4/locations/reviews/respond \-H "Authorization: API $LISTINGSAPI_KEY" \-H "Content-Type: application/json" \-d '{  "interactionId": "9e26d2a8-a6ed-42ea-8454-47d1c92ea841",  "responseContent": "Thank you for visiting Jenny Home: we are glad you enjoyed your experience!"}'
JSON
{  "data": {    "respondToInteraction": {      "interaction": {        "id": "2090753a-ece6-4837-8336-8494ad308523",        "interactionId": "9e26d2a8-a6ed-42ea-8454-47d1c92ea841",        "content": "Thank you for visiting Jenny Home: we are glad you enjoyed your experience!",        "interactionStatus": "CREATED",        "editedResponse": false      },      "errors": null    }  }}

请保留 interaction.id:它是您稍后编辑或归档回复所需的 responseId。回复被拒绝时,会返回 200,且 data.respondToInteraction 中的 errors 会填入内容,因此请读取响应体。在这种情况下,SDK 会抛出 ValidationError。

3. 确认回复已送达发布平台

interactionStatus 最初为 CREATED,随后会自动推进,无需进一步调用。稍作等待后,通过 id 重新读取评价,并检查 responded、responseCount 以及 responses[] 中的回复状态。

状态含义
CREATED已接受并加入发送至发布平台的队列。
COMPLETED已发布到发布平台。部分平台的状态到此为止。
CONFIRMED已发布并经发布平台确认。
FAILED发布平台拒绝了该回复。响应中的 remarks 说明了原因。
Re-read
curl -G "https://listingsapi.com/api/v4/reviewDetails" \-H "Authorization: API $LISTINGSAPI_KEY" \--data-urlencode 'interactionIds=["9e26d2a8-a6ed-42ea-8454-47d1c92ea841"]'
JSON
{  "id": "9e26d2a8-a6ed-42ea-8454-47d1c92ea841",  "responded": true,  "responseCount": 1,  "responses": [    {      "id": "2090753a-ece6-4837-8336-8494ad308523",      "content": "Thank you for visiting Jenny Home: we are glad you enjoyed your experience!",      "interactionStatus": "CONFIRMED",      "editedResponse": false    }  ]}

responded: true 且回复状态为 CONFIRMED 或 COMPLETED,表示客户可以看到该回复。如果您看到 FAILED,请先读取响应中的 remarks,了解发布平台给出的原因,再重试。

4. 编辑回复

POST /locations/reviews/respond/edit 需要两个 id:reviewId 是评价的 id,responseId 是第 2 步中回复的 id。编辑后的回复会重新提交,因此回复的 interactionStatus 会恢复为 CREATED,而 editedResponse 会在回复送达后变为 true。

Edit reply
curl -X POST https://listingsapi.com/api/v4/locations/reviews/respond/edit \-H "Authorization: API $LISTINGSAPI_KEY" \-H "Content-Type: application/json" \-d '{  "reviewId": "9e26d2a8-a6ed-42ea-8454-47d1c92ea841",  "responseId": "2090753a-ece6-4837-8336-8494ad308523",  "responseContent": "Thank you again: we have updated our reply to include our new store hours."}'
JSON
{  "data": {    "editResponse": {      "status": "true",      "reviewId": "9e26d2a8-a6ed-42ea-8454-47d1c92ea841",      "responseId": "2090753a-ece6-4837-8336-8494ad308523"    }  }}

编辑被接受时,status 为字符串 "true"。请按照第 3 步中的相同方式确认新措辞。

5. 归档回复

POST /locations/reviews/respond/archive 仅接收 responseId。归档会从 Listings API 中该互动的 responses 中移除回复。它不会撤回已在 Google 或 Facebook 上公开显示的回复,因此请用归档来清理失败或已被替代的草稿,对于已发布的回复则使用编辑操作。

Archive reply
curl -X POST https://listingsapi.com/api/v4/locations/reviews/respond/archive \-H "Authorization: API $LISTINGSAPI_KEY" \-H "Content-Type: application/json" \-d '{ "responseId": "2090753a-ece6-4837-8336-8494ad308523" }'
JSON
{  "data": {    "archiveResponse": {      "status": "true"    }  }}

归档后,评价的 responseCount 会减少,responded 会反映剩余的回复。

6. 通过 webhook 接收回复事件

发布、编辑或归档回复时,会触发 interaction.response 事件。载荷位于 data.interaction 下,其中 type: "Response",parent_id 为评价的 id,因此您无需再次调用即可将其与自己的记录匹配。与 interaction.review 一样,其 location_id 未经过规范化,可能为 null。设置方法请参阅通过 webhook 响应事件。

后续步骤