Skip to content

A PHP interface to send requests to Rocket Chat incoming webhooks.

License

Notifications You must be signed in to change notification settings

sebastiansommer/7sg-rocketchat-webhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

7sg-rocketchat-webhook

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);