Answer the question
In order to leave comments, you need to log in
How to post a message to a group using the API?
The question is relevant for people who have experience in working with api Bitrix and modules included in the editorial board Corp. portal.
Need to post a message to a social network group using api. After digging around, I realized that the messages in the group are the user's blog posts. It was possible to create a blog using CBlogPost::Add() , but I can’t figure out how to make this blog appear in the group’s message feed.
With the help of CBlogPost::GetList() it was possible to display a list of messages and there are messages that are already in the group feed and those that I created using CBlogPost::Add() .
Answer the question
In order to leave comments, you need to log in
To send a message to a live feed, you need an even more sophisticated method.
We connect the Social network module:
To send a message to the feed, you need to have a post that will be sent to the feed, so first create a post:
$arFields = array(
"TITLE" => "Заголовок записи",
"DETAIL_TEXT" => "Тело сообщения",
"BLOG_ID" => 1, //ID отправителя
"AUTHOR_ID" => 1, //ID блога, в котором будет запись
"DATE_PUBLISH" => '11.02.2014 09:08', // дада
"PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, // Читаем в API
"ENABLE_TRACKBACK" => 'N',
"ENABLE_COMMENTS" => 'Y'
);
$arEvent = array (
'EVENT_ID' => 'blog_post',
'=LOG_DATE' => 'now()',
'TITLE_TEMPLATE' => '#USER_NAME# добавил(а) сообщение "#TITLE#" в блог',
'TITLE' => "Заголовок записи",
'MESSAGE' => "Текст записи",
'TEXT_MESSAGE' => "Текст записи",
'MODULE_ID' => 'blog',
'CALLBACK_FUNC' => false,
'SOURCE_ID' => $ID,
'ENABLE_COMMENTS' => 'Y',
'RATING_TYPE_ID' => 'BLOG_POST',
'RATING_ENTITY_ID' => $newID,
'ENTITY_TYPE' => 'U',
'ENTITY_ID' => '1',
'USER_ID' => '1',
'URL' => '/company/personal/user/1/blog/'.$ID.'/',
);
// Выдает права
CSocNetLogRights::Add ( $eventID, array ("G3") );
// Отправляет уведомление о новом сообщении
CSocNetLog::SendEvent ( $eventID, 'SONET_NEW_EVENT' );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question