messagemedia / conversations
Conversations API 允许用户通过 Over-The-Top (OTT) 消息服务发送和接收消息进行交流。OTT 应用是指通过互联网提供产品并绕过传统分销的应用或服务。以下是这个术语的深入解释。
1.0.0
2018-06-28 01:01 UTC
Requires
- php: >=5.4.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- apimatic/jsonmapper: ~1.3.0
- mashape/unirest-php: ~3.0.1
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-16 19:38:58 UTC
README
⚠️ 注意:本文档的 API 处于测试阶段,短期内可能会进行破坏性更改。⚠️
MessageMedia Conversations API 允许用户通过 OTT 消息服务发送和接收消息进行交流。此功能默认禁用。要启用它,您不需要修改应用程序,只需通过 MessageMedia 的支持团队进行账户配置更改(support@messagemedia.com)。
⭐️ 使用 Composer 安装
运行 Composer 命令安装 Messages SDK 的最新稳定版本
composer require messagemedia/conversations-sdk
🎬 开始使用
开始使用很简单。只需将您从 MessageMedia 开发者门户 获得的 API 密钥和密码输入到下面的代码片段中。
🚀 配置账户
require_once('vendor/autoload.php'); $basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication $basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication $client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword); $provisioning = $client->getConfiguration(); $bodyValue = "{ \"name\": \"Rainbow Serpent Festival\", \"callback_url\": \"https://callback.url.com\"}"; $body = MessageMediaConversationsLib\APIHelper::deserialize($bodyValue); $configuration->createConfigureAccount($body);
🔐 Facebook 授权
require_once('vendor/autoload.php'); $basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication $basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication $client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword); $facebook = $client->getFacebook(); $result = $facebook->getFacebookAuthorisationURL();
⬇️ 获取 Facebook 页面
require_once('vendor/autoload.php'); $basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication $basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication $client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword); $facebook = $client->getFacebook(); $result = $facebook->getFacebookPages();
♻️ 集成 Facebook 页面
您可以通过查看“获取 Facebook 页面”示例的响应来获取 facebookPageId。
require_once('vendor/autoload.php'); $basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication $basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication $client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword); $facebook = $client->getFacebook(); $facebookPageId = 'facebookPageId'; $facebook->createIntegrateFacebookPage($facebookPageId);
👤 获取用户
require_once('vendor/autoload.php'); $basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication $basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication $client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword); $appUsers = $client->getAppUsers(); $result = $appUsers->getAppUsers();
💬 获取用户消息
您可以从“获取用户”示例的响应中获取 appUserId。
require_once('vendor/autoload.php'); $basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication $basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication $client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword); $appUsers = $client->getAppUsers(); $appUserId = 'appUserId'; $result = $appUsers->getAppUserMessages($appUserId);
✉️ 向用户发送消息
您可以从“获取用户”示例的响应中获取 appUserId。
require_once('vendor/autoload.php'); $basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication $basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication $client = new MessageMediaConversationsLib\MessageMediaConversationsClient($basicAuthUserName, $basicAuthPassword); $appUsers = $client->getAppUsers(); $appUserId = 'appUserId'; $body = new BaseMessageDto({"key":"value"}); $appUsers->createSendMessage($appUserId, $body);
📕 文档
查看 完整的 API 文档 以获取更详细的信息。
😕 需要帮助?
请联系开发者支持 developers@messagemedia.com 或查看开发者门户 developers.messagemedia.com
📃 许可证
Apache 许可证。查看 LICENSE 文件。