百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

laravel-notification-whatsapp

> 后端框架
开源

Whatsapp Cloud API 的 Laravel 通知频道

185 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Whatsapp Cloud API 的 Laravel 通知频道

WhatsApp notification channel for Laravel

This package makes it easy to send notifications using WhatsApp Cloud API with Laravel.

This package uses the whatsapp-cloud-api library that will allow you to send messages via the WhatsApp Cloud API from any type of project and framework written in PHP.

Contents

  • Installation
    • Setting up the WhatsApp service
  • Usage
    • Available Message methods
  • Changelog
  • Testing
  • Security
  • Contributing
  • Credits
  • License

Installation

You can install the package via composer:

composer require netflie/laravel-notification-whatsapp

Setting up the WhatsApp Cloud API

Create a new Meta application and get your Whatsapp application token and phone number id following the "Get Started" guide. Place them inside your .env file. To load them, add this to your config/services.php file:

php
 [
        'from-phone-number-id' => env('WHATSAPP_FROM_PHONE_NUMBER_ID'),
        'token' => env('WHATSAPP_TOKEN'),
    ],

];

Usage

The Whatsapp API only allows you to start conversations if you send a template message. This means that you will only be able to send template notifications from this package.

Whatsapp forces you to configure your templates before using them. You can learn how to configure your templates by following Meta's official guide on "How to create templates".

WhatsApp templates sections

A template is divided into 4 sections: header, body, footer and buttons. The header, body and buttons accept variables. The footer doesn't accept variables. You can only send variables from this package for the header and body.

Components

You have available several components that can be used to add context (variables) to your templates. The different components can be created with the component factory:

php
name('sample_movie_ticket_confirmation') // Name of your configured template
            ->header(Component::image('https://lumiere-a.akamaihd.net/v1/images/image_c671e2ee.jpeg'))
            ->body(Component::text('Star Wars'))
            ->body(Component::dateTime(new \DateTimeImmutable))
            ->body(Component::text('Star Wars'))
            ->body(Component::text('5'))
            ->buttons(Component::quickReplyButton(['Thanks for your reply!']))
            ->buttons(Component::urlButton(['reply/01234'])) // List of url suffixes
            ->to('34676010101');
    }
}

Send a text message

You can only send a text message after you've send a template and the user responded.

php
message('Hello, this is a test message')
            ->to('34676010101');
    }
}

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

bash
$ composer test

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

  • Álex Albarca
  • All Contributors

License

The MIT License (MIT). Please see License File for more information.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPlaravel-notification-channellaravel-whatsappphpsdk

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架