devture / synology-chat
A library to communicate with the Synology Chat API
Installs: 3 653
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- guzzlehttp/guzzle: >=6.3,<8.0
- guzzlehttp/psr7: >=2.0,<3.0
- symfony/property-access: *
This package is auto-updated.
Last update: 2024-11-21 14:05:25 UTC
README
A library to communicate with the Synology Chat API (just Incoming Webhooks for now).
Installation
Install through composer: composer require --dev devture/synology-chat
Usage
Preparation
$communicator = new \Devture\Component\SynologyChat\Communicator(new \GuzzleHttp\Client()); $client = new \Devture\Component\SynologyChat\Client($communicator);
Actual usage
$incomingWebhookUrl = 'https://chat.DOMAIN/chat/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=some-token'; try { $client->sendWebhookMessage($incomingWebhookUrl, 'Hello!'); } catch (\Devture\Component\SynologyChat\Exception\AuthFailure $e) { // Bad token. No such incoming webhook? } catch (\Devture\Component\SynologyChat\Exception $e) { // Another error. Likely transient and can be retried. }