https://github.com/sebastiansommer/7sg-rocketchat-webhook
A PHP interface to send requests to Rocket Chat incoming webhooks.
https://github.com/sebastiansommer/7sg-rocketchat-webhook
php php-library php7 php73 rocketchat webhook
Last synced: 7 months ago
JSON representation
A PHP interface to send requests to Rocket Chat incoming webhooks.
- Host: GitHub
- URL: https://github.com/sebastiansommer/7sg-rocketchat-webhook
- Owner: sebastiansommer
- License: mit
- Created: 2020-07-04T08:44:42.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T21:16:58.000Z (over 3 years ago)
- Last Synced: 2025-08-30T09:06:55.284Z (about 1 year ago)
- Topics: php, php-library, php7, php73, rocketchat, webhook
- Language: PHP
- Homepage:
- Size: 29.3 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 7sg-rocketchat-webhook
A PHP interface to send requests to Rocket Chat incoming webhooks.
## Install
```bash
composer require 7sg/rocketchat-webhook
```
## Usage
### Simple message
```php
use Seven\RocketChatWebHook\Message as RocketChatMessage;
use Seven\RocketChatWebHook\RocketChat;
RocketChat::setEndPoint('https:/rocketchat.url');
$message = new RocketChatMessage('Hello!');
$message->setEmoji('🥳');
RocketChat::sendMessage($message, 'webhook-hash-and-channel');
```
### Messages can also have attachments
You can find a full list of all fields [here](https://docs.rocket.chat/api/rest-api/methods/chat/postmessage#attachments-detail).
```php
$attachment = new RocketChatMessage\Attachment();
$attachment->title = 'Title';
$attachment->title_link = 'https://test.test';
$attachment->fields = [
[
'title' => 'Test',
'value' => 'value'
]
];
$message->addAttachment($attachment);
```