Views: 2436
Last Modified: 08.02.2022

Sending system notification

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

Parameters

Parameter Example Required Description Revision
SKIP_OPENLINES 'Y' No Skip Open lines chats 30
SKIP_DIALOG 'N' No Skip "person-to-person" conversations 30
SKIP_CHAT 'Y' No Skip chats 30
LAST_MESSAGE_DATE '2021-10-30' No Date of the last chat message 30


Called method and response

JavaScript

B24.callMethod(
  'im.recent.list',
  {
    LAST_MESSAGE_DATE: '2021-10-30'
  },
  res => {
    if (res.error())
    {
      console.error(result.error().ex);
    }
    else
    {
      console.log(res.data())
    }
  }
)

Response example

{
  "items": [
    {
      "id": "chat71",
      "chat_id": 71,
      "type": "chat",
      "avatar": {
        "url": "",
        "color": "#8474c8"
      },
      "title": "Violet guest No.3 - Open line 2",
      "message": {
        "id": 267,
        "text": "Form sent \"Contact details for open lines\" [Attachment]",
        "file": false,
        "author_id": 0,
        "attach": true,
        "date": "2021-10-27T18:20:45+02:00",
        "status": "received"
      },
      "counter": 3,
      "pinned": false,
      "unread": false,
      "date_update": "2021-10-27T18:20:45+02:00",
      "chat": {
        "id": 71,
        "name": "Violet guest No.3 - Open line 2",
        "owner": 0,
        "extranet": false,
        "avatar": "",
        "color": "#8474c8",
        "type": "lines",
        "entity_type": "LINES",
        "entity_id": "livechat|2|70|2016",
        "entity_data_1": "N|NONE|0|N|N|7|1635351612|0|0|0",
        "entity_data_2": "",
        "entity_data_3": "",
        "mute_list": [],
        "manager_list": [],
        "date_create": "2021-10-27T18:20:12+02:00",
        "message_type": "L"
      },
      "lines": {
        "id": 7,
        "status": 5,
        "date_create": "2021-10-27T18:20:12+02:00"
      },
      "user": {
        "id": 0
      },
      "options": []
    },
    {
      "id": "chat69",
      "chat_id": 69,
      "type": "chat",
      "avatar": {
        "url": "",
        "color": "#3e99ce"
      },
      "title": "Blue guest No.3 - Open line 2",
      "message": {
        "id": 258,
        "text": "Form sent \"Contact details for open lines\" [Attachment]",
        "file": false,
        "author_id": 0,
        "attach": true,
        "date": "2021-10-27T18:16:22+02:00",
        "status": "received"
      },
      "counter": 3,
      "pinned": false,
      "unread": false,
      "date_update": "2021-10-27T18:16:22+02:00",
      "chat": {
        "id": 69,
        "name": "Blue guest No.3 - Open line 2",
        "owner": 0,
        "extranet": false,
        "avatar": "",
        "color": "#3e99ce",
        "type": "lines",
        "entity_type": "LINES",
        "entity_id": "livechat|2|68|2015",
        "entity_data_1": "N|NONE|0|N|N|6|1635351343|0|0|0",
        "entity_data_2": "",
        "entity_data_3": "",
        "mute_list": [],
        "manager_list": [],
        "date_create": "2021-10-27T18:15:43+02:00",
        "message_type": "L"
      },
      "lines": {
        "id": 6,
        "status": 5,
        "date_create": "2021-10-27T18:15:43+02:00"
      },
      "user": {
        "id": 0
      },
      "options": []
    },
    {
      "id": "chat67",
      "chat_id": 67,
      "type": "chat",
      "avatar": {
        "url": "",
        "color": "#29619b"
      },
      "title": "Sky blue guest No.2 - Open line 2",
      "message": {
        "id": 250,
        "text": "hi",
        "file": false,
        "author_id": 2014,
        "attach": false,
        "date": "2021-10-27T17:11:36+02:00",
        "status": "received"
      },
      "counter": 5,
      "pinned": false,
      "unread": false,
      "date_update": "2021-10-27T17:11:36+02:00",
      "chat": {
        "id": 67,
        "name": "Sky blue guest No.2 - Open line 2",
        "owner": 0,
        "extranet": false,
        "avatar": "",
        "color": "#29619b",
        "type": "lines",
        "entity_type": "LINES",
        "entity_id": "livechat|2|66|2014",
        "entity_data_1": "N|NONE|0|N|N|5|1635346774|0|0|0",
        "entity_data_2": "",
        "entity_data_3": "",
        "mute_list": [],
        "manager_list": [],
        "date_create": "2021-10-27T16:59:34+02:00",
        "message_type": "L"
      },
      "lines": {
        "id": 5,
        "status": 5,
        "date_create": "2021-10-27T16:59:34+02:00"
      },
      "user": {
        "id": 2014,
        "active": true,
        "name": "Guest",
        "first_name": "Guest",
        "last_name": "",
        "work_position": "",
        "color": "#4ba5c3",
        "avatar": "",
        "gender": "M",
        "birthday": "",
        "extranet": true,
        "network": false,
        "bot": false,
        "connector": true,
        "external_auth_id": "imconnector",
        "status": "online",
        "idle": false,
        "last_activity_date": "2021-10-27T17:11:36+02:00",
        "mobile_last_date": false,
        "absent": false,
        "departments": [],
        "phones": false,
        "desktop_last_date": false
      },
      "options": []
    },
    {
      "id": "chat65",
      "chat_id": 65,
      "type": "chat",
      "avatar": {
        "url": "",
        "color": "#df532d"
      },
      "title": "John Tester - Open line 2",
      "message": {
        "id": 225,
        "text": "New deal created [Attachment]",
        "file": false,
        "author_id": 0,
        "attach": true,
        "date": "2021-10-25T14:48:28+02:00",
        "status": "received"
      },
      "counter": 6,
      "pinned": false,
      "unread": false,
      "date_update": "2021-10-25T14:48:28+02:00",
      "chat": {
        "id": 65,
        "name": "John Tester - Open line 2",
        "owner": 0,
        "extranet": false,
        "avatar": "",
        "color": "#df532d",
        "type": "lines",
        "entity_type": "LINES",
        "entity_id": "livechat|2|64|2011",
        "entity_data_1": "Y|DEAL|12|N|N|4|1635166080|0|0|0",
        "entity_data_2": "LEAD|0|COMPANY|0|CONTACT|9|DEAL|12",
        "entity_data_3": "",
        "mute_list": [],
        "manager_list": [],
        "date_create": "2021-10-25T14:48:00+02:00",
        "message_type": "L"
      },
      "lines": {
        "id": 4,
        "status": 5,
        "date_create": "2021-10-25T14:48:00+02:00"
      },
      "user": {
        "id": 0
      },
      "options": []
    },
    {
      "id": "chat39",
      "chat_id": 39,
      "type": "chat",
      "avatar": {
        "url": "",
        "color": "#4ba984"
      },
      "title": "No robot chat",
      "message": {
        "id": 161,
        "text": "here's the question",
        "file": false,
        "author_id": 1,
        "attach": false,
        "date": "2021-10-08T13:19:33+02:00",
        "status": "delivered"
      },
      "counter": 0,
      "pinned": false,
      "unread": false,
      "date_update": "2021-10-08T13:19:33+02:00",
      "chat": {
        "id": 39,
        "name": "No robot chat",
        "owner": 1018,
        "extranet": false,
        "avatar": "",
        "color": "#4ba984",
        "type": "chat",
        "entity_type": "",
        "entity_id": "",
        "entity_data_1": "",
        "entity_data_2": "",
        "entity_data_3": "",
        "mute_list": [],
        "manager_list": [],
        "date_create": "2021-09-27T15:57:53+02:00",
        "message_type": "C"
      },
      "user": {
        "id": 1,
        "active": true,
        "name": "John Smith",
        "first_name": "John",
        "last_name": "Smith",
        "work_position": "",
        "color": "#df532d",
        "avatar": "",
        "gender": "M",
        "birthday": "",
        "extranet": false,
        "network": false,
        "bot": false,
        "connector": false,
        "external_auth_id": "default",
        "status": "online",
        "idle": false,
        "last_activity_date": "2021-10-30T15:52:40+02:00",
        "mobile_last_date": "2021-10-27T16:39:26+02:00",
        "absent": false,
        "departments": [
          1
        ],
        "phones": false,
        "desktop_last_date": "2021-10-21T11:07:54+02:00"
      },
      "options": []
    },
    {
      "id": 1018,
      "chat_id": 28,
      "type": "user",
      "avatar": {
        "url": "",
        "color": "#df532d"
      },
      "title": "Chris Maxwell",
      "message": {
        "id": 160,
        "text": "Pushes incoming",
        "file": false,
        "author_id": 1018,
        "attach": false,
        "date": "2021-10-08T13:19:32+02:00",
        "status": "delivered"
      },
      "counter": 0,
      "pinned": false,
      "unread": false,
      "date_update": "2021-10-08T13:20:59+02:00",
      "user": {
        "id": 1018,
        "active": true,
        "name": "Chris Maxwell",
        "first_name": "Chris",
        "last_name": "Maxwell",
        "work_position": "",
        "color": "#df532d",
        "avatar": "",
        "gender": "M",
        "birthday": "",
        "extranet": false,
        "network": false,
        "bot": false,
        "connector": false,
        "external_auth_id": "default",
        "status": "online",
        "idle": false,
        "last_activity_date": "2021-10-29T16:29:17+02:00",
        "mobile_last_date": "2021-10-08T13:24:22+02:00",
        "absent": false,
        "departments": [
          1
        ],
        "phones": false,
        "desktop_last_date": "2021-10-18T16:51:09+02:00"
      },
      "options": []
    }
  ],
  "hasMore": false
}

Key description:

  • id – dialog ID (numeral indicates a user; when chatXXX – indicates chat)
  • type – record type (user indicates a user, when chat – indicates chat)
  • avatar – record avatar description object:
    • url – avatar link (when empty, avatar is specified)
    • color – dialog color in hex format
  • title – record title (first and last name – for user, dialog name – for chat)
  • messages – message description object:
    • id – message ID
    • text – message text (without BB-codes and line breaks)
    • file – files are available (true/false)
    • attach – attachments are available (true/false)
    • author_id – message author
    • date – message date
  • counter – unread messages counter
  • user – user data description object (unavailable, when this record type - chat):
    • id – user ID
    • name – user first and last name
    • first_name – user first name
    • last_name – user last name
    • work_position – position
    • color – user color in hex format
    • avatar – avatar link (when empty, avatar is not specified)
    • gender – user gender
    • birthday – user birthday in DD-MM format, when empty – not specified
    • extranet – extranet user attribute (true/false)
    • networkBitrix24.Network network user attribute (true/false)
    • bot – bot attribute (true/false)
    • connector – open lines user attribute (true/false)
    • external_auth_id – external auth code
    • status – selected user status
    • idle – date, when user is away from computer, in АТОМ format (when not specified, then false)
    • last_activity_date – date of the user last activity in АТОМ format
    • mobile_last_date – date of the last activity in mobile app in АТОМ format (when not specified, then false)
    • absent – date when user vacation ends, in АТОМ format (when not specified, then false)
  • chat – chat data object description (unavailable, when record type is user):
    • id – chat ID
    • title – chat name
    • owner – chat owner-user ID
    • extranet – extranet user chat participation attribute (true/false)
    • color – chat color in hex format
    • avatar – avatar link (when empty, then avatar is not specified)
    • type – chat type (group chat, call chat, open lines chat and etc.)
    • entity_type – external code for chat – type
    • entity_id – chat external code – ID
    • entity_data_1 – external data for chat
    • entity_data_2 – external data for chat
    • entity_data_3 – external data for chat
    • date_create – chat created date in АТОМ format
    • message_type – chat message type
  • pinned – attached chat or not
  • unread – manual mark for chat as unread
  • date_update – date of the last update in associated entities



Courses developed by Bitrix24