navvygator/manychat-php-sdk

ManyChat API的非官方PHP SDK

v1.0.0 2022-11-08 06:59 UTC

This package is auto-updated.

Last update: 2024-09-08 11:13:13 UTC


README

这是一个基于ManyChat公共API的非官方SDK: https://api.manychat.com/swagger

要求

  • php 7.1+

安装

建议通过 Composer 安装Guzzle。

composer require navvygator/manychat-php-sdk

示例

初始化客户端

$apiKey = '12345678987654321:aabbccddeeff11223344ffddbbccaa';
$client = new ManychatClient($apiKey);

处理页面作用域API

$client->page()->getInfo(); //get page's info
$client->page()->createTag('new API tag'); //create new tag
$client->page()->createBotField('New bot field', 'number', 'test bot field', 88);

处理订阅者作用域API

$subscriber = $client->subscriber()->findByName('John Smith'); // find subscriber by full name
$subscriber = $client->subscriber()->getInfo(257545534557); //get the subscriber's info by subscriber id
$client->subscriber()->addTagByName(257545534557, 'new API tag'); // apply tag to subscriber

处理发送API

$client->sender()->sendContent(257545534557, $content); // send dynamic content to the subscriber
$client->sender()->sendFlow(257545534557, 'flow_123'); //send flow to the subscriber