A PHP interface to send requests to Rocket Chat incoming webhooks.
composer require 7sg/rocketchat-webhook
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');
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);