forte-tecnologia / whastapp-sdk
用于通过WhatsApp发送消息的SDK
v0.0.2
2024-06-05 17:01 UTC
Requires
- php: >=7.1.0
This package is auto-updated.
Last update: 2024-09-11 17:13:09 UTC
README
此仓库包含一个示例,演示如何使用ForteTecnologia的SDK通过WhatsApp发送消息。
安装
要安装SDK,请使用Composer。在终端中,执行以下命令
composer require forte-tecnologia/whastapp-sdk
使用方法
在examples
文件夹中,您将找到一个名为send-message.php
的文件,该文件演示了如何通过WhatsApp发送消息。
<?php require __DIR__ . '/../vendor/autoload.php'; use ForteTecnologia\Whastapp\Http\Client; // Credenciais $email = 'xxxxxxx@xxxxxxx.com'; $password = 'xxxxxxx'; // exemplo: // https://xxxxxxx.fortetecnologiaapp.com.br $company = 'xxxxxxx'; // Inicializa o cliente e autentica $client = new Client(); $token = $client->auth($email, $password); // Cria a mensagem $message = [ 'company' => $company, 'to' => '63999999999', 'message' => 'Bom dia!' ]; // Envia a mensagem $response = $client->messages()->send($token, $message);
凭证
要使用SDK,您需要在ForteTecnologia上注册一个电子邮件和密码。如果您还没有,请联系我们。