7sg / rocketchat-webhook
1.0.1
2021-02-19 07:59 UTC
Requires
- guzzlehttp/guzzle: ^6.5|^7.0
This package is auto-updated.
Last update: 2024-10-20 00:49:23 UTC
README
A PHP interface to send requests to Rocket Chat incoming webhooks.
Install
composer require 7sg/rocketchat-webhook
Usage
Simple message
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.
$attachment = new RocketChatMessage\Attachment(); $attachment->title = 'Title'; $attachment->title_link = 'https://test.test'; $attachment->fields = [ [ 'title' => 'Test', 'value' => 'value' ] ]; $message->addAttachment($attachment);