承接 ges/laravel-green-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ges/laravel-green-api

Composer 安装命令:

composer require ges/laravel-green-api

包简介

Core Green API integration for Laravel.

README 文档

README

Laravel package for Green API inbound webhooks, outbound messaging, and a persisted WhatsApp-like inbox model.

Install

composer require ges/laravel-green-api
php artisan green-api:install
php artisan migrate

Configuration

Publish the config file and set the Green API credentials:

GREEN_API_URL=
GREEN_API_MEDIA_URL=
GREEN_API_INSTANCE_ID=
GREEN_API_TOKEN=
GREEN_API_TEST_CHAT_ID=
GREEN_API_WEBHOOK_URL=
GREEN_API_WEBHOOK_AUTHORIZATION_HEADER=

The package uses App\Models\User as the default contact model and adds a dynamic greenApiConversation relation automatically at boot.

Commands

php artisan green-api:check-connection
php artisan green-api:sync-webhook

Usage

use Ges\LaravelGreenApi\Services\GreenApiInboxService;

$inbox = app(GreenApiInboxService::class);
$message = $inbox->sendTextMessage($user, 'Hello');
$conversation = $user->greenApiConversation;

Inbound webhooks are exposed at POST /green-api/webhook.

Notifications

The package also exposes a Laravel notification channel via GreenApiChannel.

use Ges\LaravelGreenApi\Notifications\GreenApiChannel;
use Ges\LaravelGreenApi\Notifications\GreenApiMessage;
use Illuminate\Notifications\Notification;

class InvoicePaid extends Notification
{
    public function via(object $notifiable): array
    {
        return [GreenApiChannel::class];
    }

    public function toGreenApi(object $notifiable): GreenApiMessage
    {
        return GreenApiMessage::make('Invoice paid.');
    }
}

You can also use the driver alias if you prefer:

public function via(object $notifiable): array
{
    return ['green_api'];
}

For file delivery:

public function toGreenApi(object $notifiable): GreenApiMessage
{
    return GreenApiMessage::make()
        ->file(storage_path('app/invoice.pdf'), 'Invoice attached', 'invoice.pdf');
}

When the notifiable is the configured contact model, notifications are persisted into the package inbox. For anonymous or non-model notifiables, route the destination with green_api:

use Illuminate\Support\Facades\Notification;

Notification::route('green_api', '+33 6 12 34 56 78')
    ->notify(new InvoicePaid);

统计信息

  • 总下载量: 438
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固