Documentation

OnDeleteMessageCustom

OnDeleteMessageCustom deletes message from Open Channel

The event receives the following parameters:

Parameter Description
CONNECTOR Connector ID. Use it to check if the event relates to you.
LINE Open Channel ID
DATA Array containing arrays describing the message:
 array (
      'im' =>
      array (
//Chat ID within Bitrix24
        	'chat_id' => 845,
        	//Message ID within Bitrix24
        	'message_id' => 344029,
      ),
      'message' =>
      array (
        //Array of IDs for edited messages in an external system
        // (sendStatusDelivery must return new IDs, event if they are the same).
        // Foresee the case when only one value can be returned!
        'id' =>
        array (
          0 => '99',
        ),
        //New message text
        'text' => '[b]John Smith:[/b][br] Text message #55',
      ),
      'chat' =>
      array (
        //Chat ID in an external system
        'id' => '2',
      ),
 );

Example

\Bitrix\Main\EventManager::getInstance()->addEventHandler("imconnector", "OnDeleteMessageCustom", Array("Message", "OnDeleteMessageCustomHandler"));

class Message
{
  function OnDeleteMessageCustomHandler(\Bitrix\Main\Event $event)
  {
     $connector = $event->getParameter('CONNECTOR');
     $line = $event->getParameter('LINE');
     $data = $event->getParameter('DATA');

     //test
     define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/log.txt");
     AddMessage2Log(var_export(array('$connector' => $connector, '$line' => $line,'$data' => $data),1), 'SendMessage');
     //END test
  }
}


© «Bitrix24», 2001-2024
Up