Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devture/synology-chat
A library to communicate with the Synology Chat API
https://github.com/devture/synology-chat
Last synced: 13 days ago
JSON representation
A library to communicate with the Synology Chat API
- Host: GitHub
- URL: https://github.com/devture/synology-chat
- Owner: devture
- License: bsd-3-clause
- Created: 2019-06-20T07:48:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-21T06:41:23.000Z (over 3 years ago)
- Last Synced: 2024-09-23T03:23:47.554Z (about 2 months ago)
- Language: PHP
- Size: 4.88 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Synology Chat API
A library to communicate with the [Synology Chat API](https://www.synology.com/en-global/knowledgebase/DSM/help/Chat/chat_integration) (just Incoming Webhooks for now).
## Installation
Install through composer: `composer require --dev devture/synology-chat`
## Usage
### Preparation
```php
$communicator = new \Devture\Component\SynologyChat\Communicator(new \GuzzleHttp\Client());
$client = new \Devture\Component\SynologyChat\Client($communicator);
```### Actual usage
```php
$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.
}
```