{"id":15293893,"url":"https://github.com/paragraf-lex/viber-bot","last_synced_at":"2025-04-13T14:08:41.643Z","repository":{"id":54201097,"uuid":"164611937","full_name":"paragraf-lex/viber-bot","owner":"paragraf-lex","description":"A Laravel package for Viber bot","archived":false,"fork":false,"pushed_at":"2021-02-16T19:20:32.000Z","size":65,"stargazers_count":7,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T14:08:27.361Z","etag":null,"topics":["bot","laravel","laravel-framework","php","viber","viber-bot"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paragraf-lex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-08T09:22:27.000Z","updated_at":"2021-09-09T19:04:50.000Z","dependencies_parsed_at":"2022-08-13T09:01:09.669Z","dependency_job_id":null,"html_url":"https://github.com/paragraf-lex/viber-bot","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragraf-lex%2Fviber-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragraf-lex%2Fviber-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragraf-lex%2Fviber-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragraf-lex%2Fviber-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paragraf-lex","download_url":"https://codeload.github.com/paragraf-lex/viber-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724630,"owners_count":21151561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","laravel","laravel-framework","php","viber","viber-bot"],"created_at":"2024-09-30T16:53:35.924Z","updated_at":"2025-04-13T14:08:41.625Z","avatar_url":"https://github.com/paragraf-lex.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Viber Bot\n\n[![Latest Version](https://img.shields.io/github/release/paragraf-lex/viber-bot.svg?style=flat-square)](https://github.com/paragraf-lex/viber-bot/releases)\n[![StyleCI](https://styleci.io/repos/164611937/shield)](https://styleci.io/repos/164611937)\n\n## Installation\n\nThis package can be installed through Composer.\n\n``` bash\ncomposer require paragraf-lex/viber-bot\n```\n\nIn Laravel 5.5 and above the package will autoregister the service provider. In Laravel 5.4 you must install this service provider.\n\n```php\n// config/app.php\n'providers' =\u003e [\n    ...\n    Paragraf\\ViberBot\\ViberBotServiceProvider::class,\n    ...\n];\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n\n\n## Configuration\n\nYou need to set in `.env` and setup `webhook`.\n\n#### Env\n```bash\nVIBERBOT_API=your_viber_token\nVIBERBOT_NAME=name\nVIBERBOT_PHOTO=photo\n```\nYou can find Viber token on [Viber Partners](https://partners.viber.com) after creating bot on Info tab.\n\n#### WebHook\nYou must run artisan command for webhoook with url parameter\n```bash\nphp artisan viber-bot:webhook https://example-url.com/some-route\n```\nNote: It must be full url and must be HTTPS.\n\n#### Config file\nOptionally, you can publish the config file of this package with this command:\n\n``` bash\nphp artisan vendor:publish --provider=\"Paragraf\\ViberBot\\ViberBotServiceProvider\"\n```\n\nThe following config file will be published in `config/viberbot.php`\n\n## Usage\n\nWhen the installation is done you have access to `Bot` and `Client` class.\n\n### Bot class\n\nWith bot class you naivgate your ViberBot how to work.\n\n```php \n(new Bot($request, new TextMessage()))\n  -\u003eon(new MessageEvent($request-\u003etimestamp, $request-\u003emessage_token, \n  new ViberUser($request-\u003esender['id'],$request-\u003esender['name']), $request-\u003emessage))\n  -\u003ehears(\"Hi!\")\n  -\u003ereplay(\"Hello World!\")\n  -\u003esend();\n```\nNote: If viber user not set `name` you will get error.\n\nYou can change responding type Message and Event who listen that event.\n\n| API | Accept | Description |\n| --- | --- | --- |\n| `on(new MessageEvent(...))` | `Event object` | Listen specific Event |\n| `hears(\"Hi!\")` | `string, array, regex` | ViberBot listen key word `Hi!`, can be array for more words for one event |\n| `body($callback)` | `callback` | ViberBot can do some business logic. |\n| `replay(\"Hello World!\")` | `string, array, Model` | ViberBot respond with `Hello World!`, can be array or Model |\n| `send()` | --- | Send respond to Viber server. |\n\n\n#### List of Events:\n\n - ConversationStartedEvent\n - DeliveredEvent\n - FailedEvent\n - MessageEvent\n - SeenEvent\n - SubscribedEvent\n - UnsubscribedEvent\n \n Note: \n If you don't want to listen all events you can change `event_types` in `config/viberbot.php`.\n If you change you must run again `php artisan viber-bot:webhook your-url` in oreder to apply changes.\n \n \n#### List of Messages:\n \n - TextMessage\n - BroadcastMessage\n - ContactMessage\n - FileMessage\n - KeyboardMessage\n - LocationMessage\n - PictureMessage\n - StickerMessage\n - URLMessage\n - VideoMessage\n - WelcomeMessage\n - CarouselMessage - ToDo\n\n### Client class\n\nClient class, provide to you extra utility.\n\n```php \n (new Client())-\u003ebroadcast('Hello', User::all(), 'viber_id');\n```\n\n| API |Description |\n| --- | --- |\n| `broadcast($text, $model, $method)` | Broadcast message to all subscribed user on Viber Chat, 300 users per request. |\n| `getUserDetails($user_id)` | Get details for specific user |\n| `getOnlineStatus(array $viberIds)` | Get online statuses for users, 100 users per request |\n| `getAccountInfo()` | Get account information (Your Public Account) |\n| `removeWebhook()` | Remove WebHook |\n\nNote: `$method` in `broadcast()` must point to viber_id. Also `getOnlineStatus()` need `viber_ids`.\n\nIf you want more information about Viber API or how something works check [Viber REST API](https://developers.viber.com/docs/api/rest-bot-api/)\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email nemanja.ivankovic@paragraf.rs instead of using the issue tracker.\n\n## Credits\n\n- [Nemanja Ivankovic](https://github.com/necko1996)\n- [All Contributors](../../contributors)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparagraf-lex%2Fviber-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparagraf-lex%2Fviber-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparagraf-lex%2Fviber-bot/lists"}