Views: 1537
Last Modified: 09.02.2022

Creates new entities from chat message: new chat, task, Feed post, calendar event

Revision Get current information about current API revision (platform version) – im.revision.get : 30

Parameters

Parameter Example Required Description Revision
MESSAGE_ID 289 Yes Message ID use to create new entity 30
DIALOG_ID 'chat74' Yes Dialog ID. Format:
  • chatXXX – recipient chat in case of chat message
  • or
  • XXX – recipient ID, in case of private conversation message
30
TYPE 'TASK' Yes Created entity type:
  • 'CHAT' – creates new chat based on message
  • 'TASK' – creates new task based on message
  • 'POST' – creates Feed post based on message
  • 'CALEND' – creates calendar event based on message
30

Pass the message having the selection of bot commands.


Called method and response

JavaScript

B24.callMethod(
  'im.message.share',
  {
    MESSAGE_ID: 289,
    DIALOG_ID: 'chat74',
    TYPE: 'CHAT',
  },
  res => {
    if (res.error())
    {
      console.error(result.error().ex);
    }
    else
    {
      console.log(res.data())
    }
  }
)

Response example

true

Example of response on error

{
  "error":"PARAMS_ERROR",
  "error_description":"Incorrect params"
}

Key description:

  • error – error code
  • error_description – error brief description

Possible error codes

Code Description
MESSAGE_ID_ERROR Parameter MESSAGE_ID not specified or isn't an integer
DIALOG_ID_EMPTY Parameter DIALOG_ID not specified or doesn't match the format
ACCESS_ERROR Current user doesn't have access permission to chat or conversation
PARAMS_ERROR Parameter TYPE not specified or doesn't match to the available parameters




Courses developed by Bitrix24