Instagram消息Webhook异常:Recipient ID与connected_instagram_account ID不匹配
Instagram Webhook Recipient ID 与关联账号ID不一致的解决方法
核心原因
- ID类型不匹配:你存储的
connected_instagram_account ID是Instagram业务账号(创作者/商家号)的ID,而Webhook返回的recipient id是该IG账号绑定的Facebook页面ID。因为Instagram消息Webhook本质是基于绑定的Facebook页面触发的,所以默认返回FB页面ID而非IG账号ID。 - 字段存储错误:首次关联账号时,可能误存了Graph API返回对象中的FB页面ID,而非
connected_instagram_account节点下的IG账号ID。
解决步骤
补存FB页面与IG账号的绑定关系
在首次关联账号时,除了存储connected_instagram_account.id和access token,额外调用Graph API获取该IG账号对应的FB页面ID:GET /{connected_instagram_account_id}?fields=connected_page将返回的
connected_page.id与IG账号ID绑定存入数据库。通过Webhook的recipient id匹配IG账号
当Webhook触发时,用收到的recipient id(即FB页面ID)调用API反向获取对应的IG账号ID:GET /{recipient_id}?fields=instagram_business_account再通过返回的
instagram_business_account.id匹配数据库中的记录。核对首次关联的字段
检查你存储的connected_instagram_account ID是否正确:调用/me/connected_instagram_accounts接口时,返回的每个对象里,id字段是IG账号ID,connected_page字段才是对应的FB页面ID,确保存储的是前者。确认账号类型
确保关联的是Instagram业务账号(创作者或商家账号),个人账号无法触发消息Webhook,且必须完成与Facebook页面的绑定。
内容的提问来源于stack exchange,提问作者Moaz Ali
相关产品推荐
相关产品推荐

