PHP code example of 7sg / rocketchat-webhook
1. Go to this page and download the library: Download 7sg/rocketchat-webhook library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
7sg / rocketchat-webhook example snippets
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');
$attachment = new RocketChatMessage\Attachment();
$attachment->title = 'Title';
$attachment->title_link = 'https://test.test';
$attachment->fields = [
[
'title' => 'Test',
'value' => 'value'
]
];
$message->addAttachment($attachment);