Skip to content

Latest commit

 

History

History
 
 

Messages

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

You have to be logged in and have relevant permissions.

GET MESSAGE

$message = new \ATDev\RocketChat\Messages\Message();
$message->setMessageId("[MESSAGE ID]");
$result = $message->getMessage();

if (!$result) {
	// Log the error
	$error = $message->getError();
}

POST MESSAGE

$message = new \ATDev\RocketChat\Messages\Message();
$message->setRoomId("[ROOM ID]");
$message->setText("Message text");
$result = $message->postMessage();

if (!$result) {
	// Log the error
	$error = $message->getError();
}

UPDATE MESSAGE

$message = new \ATDev\RocketChat\Messages\Message();
$message->setRoomId("[ROOM ID]");
$message->setMessageId("[MESSAGE ID]");
$message->setText("Updated message text");
$result = $message->update();

if (!$result) {
	// Log the error
	$error = $message->getError();
}

DELETE MESSAGE

$message = new \ATDev\RocketChat\Messages\Message();
$message->setRoomId("[ROOM ID]");
$message->setMessageId("[MESSAGE ID]");
$result = $message->delete();

if (!$result) {
	// Log the error
	$error = $message->getError();
}