You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WhatsApp location_request_message调用失败:OAuthException错误

解决WhatsApp Business API发送位置请求消息的OAuthException(错误码100)

问题详情

调用WhatsApp Business API v12.0发送位置请求消息时,收到参数验证错误:

{
    "error": {
        "message": "(#100) Param interactive['type'] must be one of {ADDRESS_MESSAGE, BUTTON, CATALOG_MESSAGE, GALAXY_MESSAGE, LIST, MENU_OPTIONS, MESSAGE_WITH_LINK, MESSAGE_WITH_LINK_STATUS, ORDER_DETAILS, ORDER_STATUS, PRODUCT, PRODUCT_LIST} - got \"location_request_message\".",
        "type": "OAuthException",
        "code": 100,
        "fbtrace_id": "AgvvDCuplk_cuF-hR4oQCTD"
    }
}

当前使用的请求Payload存在类型错误:

{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "<phone_number>",
    "type": "interactive",
    "interactive":{
            "type": "location_request_message",
            "body": {
              "type": "text",
              "text": "Please provide your location"
            },
            "action": {
              "name": "send_location" 
            }         
 }
}

其他类型的交互式消息(按钮、列表等)均可正常发送,仅位置请求失败。

错误原因

WhatsApp Business API中,请求用户发送位置的功能属于button类型的交互式消息,并没有单独的location_request_message类型。你错误地将interactive.type设置为了API未支持的取值,触发了参数校验错误。

正确请求格式

将interactive.type改为button,并在action.buttons中添加一个type为location_request的按钮,正确的Payload如下:

{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "<phone_number>",
    "type": "interactive",
    "interactive": {
        "type": "button",
        "body": {
            "text": "Please provide your location"
        },
        "action": {
            "buttons": [
                {
                    "type": "location_request",
                    "location_request": {
                        "title": "Share Location"
                    }
                }
            ]
        }
    }
}

验证步骤

  1. 替换Payload中的<phone_number>为目标用户的WhatsApp号码
  2. 确保请求URL为https://graph.facebook.com/v12.0/<phone_number_id>/messages,替换<phone_number_id>为你的业务号码ID
  3. 请求头中携带有效的access token
  4. 发送请求后,用户端会收到带有"Share Location"按钮的消息,点击即可快速发送位置

内容的提问来源于stack exchange,提问作者Chinmoy Biswas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 13:42:31