{"id":15046354,"url":"https://github.com/he110/communication-tools","last_synced_at":"2025-07-07T20:08:43.421Z","repository":{"id":62515217,"uuid":"201539796","full_name":"he110/communication-tools","owner":"he110","description":"Tools set for messenger managing. Allows you to send any content via Telegram, Viber, WhatsApp, VK and so on.","archived":false,"fork":false,"pushed_at":"2020-01-16T05:03:04.000Z","size":422,"stargazers_count":17,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-08T18:06:55.437Z","etag":null,"topics":["facebook-bot","php","telegram-bot","viber-bot","vk-bot","whatsapp-bot"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/he110.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-09T21:00:58.000Z","updated_at":"2024-03-23T17:31:38.000Z","dependencies_parsed_at":"2022-11-02T13:31:01.283Z","dependency_job_id":null,"html_url":"https://github.com/he110/communication-tools","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/he110%2Fcommunication-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/he110%2Fcommunication-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/he110%2Fcommunication-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/he110%2Fcommunication-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/he110","download_url":"https://codeload.github.com/he110/communication-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238394323,"owners_count":19464583,"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":["facebook-bot","php","telegram-bot","viber-bot","vk-bot","whatsapp-bot"],"created_at":"2024-09-24T20:53:01.241Z","updated_at":"2025-02-12T00:31:40.939Z","avatar_url":"https://github.com/he110.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Communication Tools [![Build Status](https://travis-ci.com/he110/communication-tools.svg?branch=master)](https://travis-ci.com/he110/communication-tools)\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/he110/communication-tools.svg)](https://packagist.org/packages/he110/communication-tools) [![codecov](https://codecov.io/gh/he110/communication-tools/branch/master/graph/badge.svg)](https://codecov.io/gh/he110/communication-tools) [![Maintainability](https://api.codeclimate.com/v1/badges/8fba6456c0c825fc252a/maintainability)](https://codeclimate.com/github/he110/communication-tools/maintainability)\n\nTools set for messenger managing. Allows you to send any content via Telegram, Viber, WhatsApp, VK, Facebook Messenger and so on.\n\n## Installation\n\nInstall the latest version with\n\n```bash\n$ composer require he110/communication-tools\n```\n\n## Basic Usage\n\n### Messenger's clients\n```php\n\u003c?php\n\n// Telegram client's taken as an example. You can use other\nuse He110\\CommunicationTools\\Telegram\\Messenger;\nuse He110\\CommunicationTools\\MessengerScreen;\n\n$messenger = new Messenger();\n$messenger-\u003esetAccessToken(YOUR_TOKEN_HERE);\n\n// If you want, to send simple text message\n$messenger-\u003esendMessage(\"Your message text here\");\n\n// To send image use method sendImage\n$messenger-\u003esendImage(\"path/to/file\", \"(Optional) Your text description\");\n// or, to send document...\n$messenger-\u003esendDocument(\"path/to/file\", \"(Optional) Your text description\");\n// you can also send voice files\n$messenger-\u003esendVoice(\"path/to/file\");\n\n// If you wanna use buttons, it's better way to use MessengerScreen\n$screen = new MessengerScreen();\n$screen-\u003eaddMessage(\"Your message text here\");\n$screen-\u003eaddButtonText(\"Text button\");\n$screen-\u003eaddButtonLink(\"URL button\", \"https://google.com\");\n$messenger-\u003esendScreen($screen);\n\n```\n\n### Multiple messengers\n```php\n\u003c?php\n\n// Telegram client's taken as an example. You can use other\nuse He110\\CommunicationTools\\MessengerPool;\nuse He110\\CommunicationTools\\Telegram\\Messenger;\nuse He110\\CommunicationTools\\MessengerScreen;\n\n$messenger = new Messenger();\n$messenger-\u003esetAccessToken(YOUR_TOKEN_HERE);\n\n// Pool allows you to use multiple messengers as one\n$pool = new MessengerPool();\n$pool-\u003eadd($messenger);\n\n$pool-\u003esendMessage(\"Your message text here\");\n\n// If you wanna use buttons, it's better way to use MessengerScreen\n$screen = new MessengerScreen();\n$screen-\u003eaddMessage(\"Your message text here\");\n$screen-\u003eaddButtonText(\"Text button\");\n$screen-\u003eaddButtonLink(\"URL button\", \"https://google.com\");\n$pool-\u003esendScreen($screen);\n\n```\n\n\n### Work with events\n```php\n\u003c?php\n\n// Telegram client's taken as an example. You can use other\nuse He110\\CommunicationTools\\Telegram\\Messenger;\nuse He110\\CommunicationTools\\Request;\nuse He110\\CommunicationTools\\MessengerUser;\n\n$messenger = new Messenger();\n$messenger-\u003esetAccessToken(YOUR_TOKEN_HERE);\n\n// Action for simple incoming messages\n$messenger-\u003eonMessage(function(Request $request) use ($messenger) {\n    // Your code here...\n    $text = $request-\u003egetMessage();\n    /** @var MessengerUser $user $user */\n    $user = $request-\u003egetUser();\n    $messenger-\u003esetTargetUser($user-\u003egetUserId());\n    $messenger-\u003esendMessage(\"We've got your message: '$text'\");\n});\n\n// Action for buttons click\n$messenger-\u003eonButtonClick(function(Request $request) use ($messenger) {\n     // Your code here...\n     $payload = $request-\u003egetPayload();\n});\n\n// Required!!! Run this method to check if events are triggered\n$messenger-\u003echeckEvents();\n\n```\n\n## About\n\n### Requirements\n\n- Communication Tools works with PHP 7.2 or above.\n\n### Submitting bugs and feature requests\n\nBugs and feature request are tracked on [GitHub](https://github.com/he110/communication-tools/issues)\n\n### Author\n\nIlya S. Zobenko - \u003cilya@zobenko.ru\u003e - \u003chttp://twitter.com/he110_todd\u003e\n\n### License\n\n\"Communication Tools\" is licensed under the MIT License - see the `LICENSE` file for detail\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhe110%2Fcommunication-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhe110%2Fcommunication-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhe110%2Fcommunication-tools/lists"}