我一直在尝试使用云 API 发送 Whatsapp 消息,但它期望启用 Whatsapp_business_messaging 权限,该权限在与已创建的任何应用程序关联时默认处于禁用状态。
https://developers.facebook.com/docs/whatsapp/cloud-api/get-started#get-access-token。
我没有找到任何与启用上述权限相关的文档。请帮忙。
为了启用该权限,您需要按照以下步骤操作:
1. Sign into the Meta Business Suite.
2. Locate your business account in the top-left dropdown menu and click its Settings (gear) icon.
3. Click Business settings.
4. Navigate to Accounts > WhatsApp Accounts.
5. Select the appropriate WhatsApp Business Account.
6. Select the WhatsApp Account Access tab.
7.Click the +Add people button.
8.Select the appropriate system user and assign appropriate access levels on the WhatsApp Business Account.
确保在更新权限后生成系统令牌,以便使用您需要的新权限生成它。
已编辑
WhatsApp 云 API 现已公开!
根据他们的文档,
要开始使用它进行开发,请先准备
欲了解更多信息,请参阅whatsapp云入门文档
是的,WhatsApp Cloud API 现已公开。
借助 Cloud API,企业可以在几分钟内直接从 Facebook 访问 WhatsApp Business API。
有关更多信息,请查看此 WhatsApp Cloud API 指南。
我最近为新的 WhatsApp Cloud API 制作了一个开源 python 包装器,以帮助开发人员轻松入门,你真的想看看它https://github.com/neurotech-HQ/heyoo。
安装
pip install --upgrade heyoo
这是发送消息的示例代码;
>>> from heyoo import WhatsApp
>>> messenger = WhatsApp('TOKEN', phone_number_id='104xxxxxx')
>>> messenger.send_template('hello_world', 'your number')
对于 Javascript 开发者,请查看 Heyhooh
安装
npm install heyooh
这里如何发送发送消息;
import WhatsApp from heyhooh
let messenger = new WhatsApp('TOKEN', phone_number_id='104xxxxxx')
messenger.send_template("hello_world", "255757xxxxxx")
对于 PHP 开发人员 whatsappcloud-php
安装
composer require zepson/whatsappcloud-php
这里是如何发送消息的代码;
<?php
require_once 'vendor/autoload.php';
use zepson\Whatsapp\WhatsappClass;
$token = 'YOUR_META_WHATSAPP_APP_ACCESS_TOKEN';
$phone_number_id = '10726082513218961';
//send message
$tsap = new WhatsappClass( $phone_number_id, $token);
$sendtsap = $tsap->send_template('hello_world', '255654485755');
print_r($sendtsap);