使用WhatsApp Graph API发送消息遇Error 100问题求助
问题描述
我正在通过Meta(Facebook)Graph API发送WhatsApp消息,使用的端点为:
https://graph.facebook.com/v21.0/${{phoneNumber-id}}/messages
请求体如下:
{ "messaging_product": "whatsapp", "to": "", "type": "template", "template": { "name": "hello_world", "language": { "code": "en_US" } } }
调用API时收到如下错误响应:
{ "error": { "message": "Unsupported post request. Object with ID '${{phoneNumber-id}}' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api", "type": "GraphMethodException", "code": 100, "error_subcode": 33, "fbtrace_id": "Ap51V1Qjcw1Vh8LJ4aeP0Fm" } }
我使用Facebook提供的测试号码发送消息,已验证访问令牌和权限,但仍出现该错误。请问问题原因是什么?是否缺少特定权限或配置,还是端点中${{phoneNumber-id}}的引用方式有误?
问题排查与解决方案
端点占位符未替换为实际ID
${{phoneNumber-id}}是占位符,必须替换为Meta分配给测试号码的数字ID(不是手机号本身)。你可以在WhatsApp Business平台的测试号码管理页面找到这个ID,格式为一串纯数字,比如10987654321,直接替换到端点URL中,删除${{}}格式。访问令牌有效性或权限不足
即使验证过令牌,仍需确认:- 令牌绑定的是当前使用的测试号码所属的WhatsApp Business账户
- 令牌包含
whatsapp_business_messaging核心权限 - 测试令牌有效期为24小时,若过期需重新生成
测试号码与模板配置问题
- 确认测试号码已完成WhatsApp验证码验证流程
- 确认
hello_world模板已被Meta批准(测试模板通常自动通过,但需检查状态) - 检查请求体中
to字段是否填写了正确的国际格式号码(如+1234567890),不能为空
API版本兼容性问题
v21.0为较新版本,若存在兼容性问题,可尝试降级到稳定版本(如v20.0)测试是否恢复正常
内容的提问来源于stack exchange,提问作者Sarthak Agarwal
相关产品推荐
相关产品推荐

