/**
* @param $userId
* @param $message
* @param string $tag
* @param string $subTag
* @param Attach|null $attachObject
* @return array
* @throws Bitrix24Exception
* @throws \Bitrix24\Bitrix24SecurityException
* @throws \Bitrix24\Bitrix24Exception
* @throws \Bitrix24\Bitrix24ApiException
* @throws \Bitrix24\Bitrix24TokenIsInvalid
* @throws \Bitrix24\Bitrix24TokenIsExpired
* @throws \Bitrix24\Bitrix24WrongClientException
* @throws \Bitrix24\Bitrix24MethodNotFoundException
* @throws \Bitrix24\Bitrix24SecurityException
*/
public function addSystem($userId, $message, $tag = '', $subTag = '', Attach $attachObject = null)
{
$arArgs = array('user_id' => (int) $userId, 'message' => (string) $message, 'tag' => (string) $tag, 'sub_tag' => (string) $subTag);
if (null === $userId) {
throw new Bitrix24Exception('user id is null');
} elseif (null === $message) {
throw new Bitrix24Exception('message is null');
} elseif (null !== $attachObject) {
$arArgs['attach'] = $attachObject->getData();
}
return $this->client->call('im.notify.system.add', $arArgs);
}