megoxv/zeromsg

ZeroMsg流畅API,用于整合Whatsapp多种消息类型。

维护者

详细信息

github.com/megoxv/zeromsg

源代码

问题

资助包维护!
megoxv

v1.0.0 2024-07-06 15:20 UTC

This package is auto-updated.

Last update: 2024-09-13 14:32:02 UTC


README

Latest Stable Version PHP Version Require License Downloads

The ZeroMsg Laravel包提供了一个流畅的接口与ZeroMsg API交互,支持文本、图片、语音、媒体、列表消息、链接预览和位置等多种消息类型。

安装

步骤1:要求包

您可以通过Composer安装此包。在终端运行以下命令

composer require megoxv/zeromsg

步骤2:配置

将您的ZeroMsg API密钥和设备ID添加到.env文件中

ZEROMSG_API_KEY=your_api_key_here
ZEROMSG_DEVICE_ID=your_device_id_here

使用

要使用ZeroMsg包,在Laravel项目中包含ZeroMsg外观。

发送文本消息

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->message('Hello, this is a test message')
    ->to('34676010101')
    ->send();

发送图片

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->message('Check out this image!')
    ->image('https://example.com/image.jpg', 'image.jpg')
    ->to('34676010101')
    ->send();

发送语音消息

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->voice('https://example.com/voice.mp3')
    ->to('34676010101')
    ->send();

发送媒体消息

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->message('Check out this media file!')
    ->media('https://example.com/media.mp4', 'media.mp4')
    ->to('34676010101')
    ->send();

发送列表消息

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->message('Check out this list!')
    ->listMessage(
        'Options',
        'Select',
        [
            [
                'title' => 'Section 1',
                'value' => 'option1',
                'description' => 'First option'
            ],
            [
                'title' => 'Section 2',
                'value' => 'option2',
                'description' => 'Second option'
            ]
        ]
    )
    ->to('34676010101')
    ->send();

发送链接预览

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->message('Check out this link!')
    ->linkPreview('https://zeromsg.com')
    ->to('34676010101')
    ->send();

发送位置

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->location('37.7749', '-122.4194', 'San Francisco', 'California, USA')
    ->to('34676010101')
    ->send();

发布资产

您可以通过使用此命令发布配置文件

php artisan vendor:publish --tag="zeromsg-config"

鸣谢

许可协议

MIT许可协议(MIT)。有关更多信息,请参阅许可文件