papalardo / bot-conversa-api-client
0.0.6
2022-08-04 18:29 UTC
Requires
- php: ^8.0.2
- ext-curl: *
- ramsey/collection: ^1.2.2
Requires (Dev)
- phpstan/phpstan: 1.7.x-dev
This package is auto-updated.
Last update: 2024-09-05 06:30:30 UTC
README
SDK,用于与 Bot conversa 集成
需求
- php 7.4
- curl
- API 密钥
安装
您可以通过 composer 安装此包
$ composer require papalardo/bot-conversa-api-client
配置
使用单例类设置配置
use Papalardo\BotConversaApiClient\BotConversaClientConfig; BotConversaClientConfig::i() ->accessToken('your-access-token') ->debug() // To enable debug info ;
可用功能
我正在开发此包以满足我的需求,因此仅创建了一些功能,例如
- 读取订阅者
- 创建订阅者
- 向订阅者发送消息
有需求我们将开发更多功能。
因此,此 SDK 按模块分组,如 文档 中所述
因此,要使用 subscriber
模块,可以这样操作
use Papalardo\BotConversaApiClient\BotConversaClient; $subscriberService = BotConversaClient::make()->subscriber(); // Creating subscriber $subscriberService->create(new CreateSubscriberData([ 'phone' => '5561000000000', 'firstName' => 'John', 'lastName' => 'Doe' ])) // Read subscriber $subscriber = $subscriberService->read('5561000000000'); // Send message $subscriberService ->sendMessage($subscriber->id(), new SendMessageData([ 'value' => 'Notification test message' ]));
备注
- 此包使用 DTO 模式,因此代码必须是您的文档。您将在 DTO 类中看到请求的有效负载
致谢
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件