yoopl/viberbot
Composer 安装命令:
composer create-project yoopl/viberbot
包简介
Laravel package for Viber bot creation
README 文档
README
The purpose of this package is to allow the use of the Viber Bot option for transactional communication with your customers, unlike other packages that are geared for advertising broadcast or answering support questions.
This package is based on paragraf-lex/viber-bot.
Installation
Install through Composer.
Setup
Env
Set the following parameters in your .env file:
VIBERBOT_API=viber_token VIBERBOT_NAME=name VIBERBOT_PHOTO=photo VIBERBOT_LOG=true VIBERBOT_SEND=true
Config
Additional configuration is available through the config file. You can publish it to your config folder:
php artisan vendor:publish --tag=viberBot
Webhook
To publish your webhook setup your route and run the following artisan command with the route name as argument:
php artisan viberbot:webhook route_name
Logging
Use the env/config parameter to turn on or off the logging of incoming hook calls and outgoing viber messages. Useful for debugging or saving a history of conversations.
You need to setup two logging channels called viberbot and viberbot_hook if you activate logging.
Subscribing a user
Use the Bot to listen to ConversationStarted events, so you can send a message to the customer, prompting a subscription to your bot. Make sure you save the viber ID that you receive upon subscription!
You can also build your Bot to answer questions, if you need to.
Sending a message
Use the Client to send messages to your subscribers and build your notifications!
- Create a message that extends one of the ViberMessage classes from the package, i.e.
Boyo\Viberbot\Messages\TextMessage - Set the
$this->textparameter (for a text message), and any other needed parameter (keyboards, media, etc.), within the Message class construct - Create an instance of the Client
$client = new ViberClient(); - Send the message, passing a ViberUser model (the recipient)
$client->send($message,$user)
Builiding a notification
- Add the viberbot channel to the via parameter in your Laravel notification
$via[] = ViberbotChannel::class; - Create a method
toViberbot($notifiable) - In this method return a Viber Message which extends one of the classes from the package, i.e.
Boyo\Viberbot\Messages\TextMessage - Set the
$this->textparameter (for a text message), and any other needed parameter (keyboards, media, etc.), within the Message class construct
yoopl/viberbot 适用场景与选型建议
yoopl/viberbot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 01 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「bot」 「laravel」 「viber」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 yoopl/viberbot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yoopl/viberbot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 yoopl/viberbot 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dialogflow php sdk
Laravel 5.6 Monolog custom telegram channel
CM.com TextClient in a Laravel Service Provider.
The library implement SMS Aero api v2
Alfabank REST API integration
VK driver for botman
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-02