Skip to content

createPrivateChat

Sahri Riza Umami edited this page Jul 1, 2018 · 4 revisions

Returns an existing chat corresponding to a given user.

createPrivateChat(user_id, force, callback, data)
Field Type Description
user_id int32 User identifier.
force Bool If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect.

Example

  • Returns existing chat corresponding to 133780085.

    createPrivateChat(133780085)

    Response:

    {
      ["@type"] = "chat",
      can_be_reported = false,
      client_data = "",
      id = 133780085,
      is_pinned = false,
      last_message = {
        ["@type"] = "message",
        author_signature = "",
        can_be_deleted_for_all_users = false,
        can_be_deleted_only_for_self = true,
        can_be_edited = false,
        can_be_forwarded = false,
        chat_id = 133780085,
        contains_unread_mention = false,
        content = {
          ["@type"] = "messageCall",
          discard_reason = {
            ["@type"] = "callDiscardReasonDeclined"
          },
          duration = 0
        },
        date = 1530436598,
        edit_date = 0,
        id = 432013312,
        is_channel_post = false,
        is_outgoing = false,
        media_album_id = "0",
        reply_to_message_id = 0,
        sender_user_id = 133780085,
        ttl = 0,
        ttl_expires_in = 0,
        via_bot_user_id = 0,
        views = 0
      },
      last_read_inbox_message_id = 0,
      last_read_outbox_message_id = 430964736,
      notification_settings = {
        ["@type"] = "notificationSettings",
        mute_for = 0,
        show_preview = true,
        sound = "default"
      },
      order = "0",
      photo = {
        ["@type"] = "chatPhoto",
        big = {
          ["@type"] = "file",
          expected_size = 0,
          id = 8,
          ["local"] = {
            ["@type"] = "localFile",
            can_be_deleted = false,
            can_be_downloaded = true,
            downloaded_prefix_size = 0,
            downloaded_size = 0,
            is_downloading_active = false,
            is_downloading_completed = false,
            path = ""
          },
          remote = {
            ["@type"] = "remoteFile",
            id = "AQADBQADvKcxG-t28AEACEIpHSwABDCcHxjsa4E_sL4AAgI",
            is_uploading_active = false,
            is_uploading_completed = true,
            uploaded_size = 0
          },
          size = 0
        },
        small = {
          ["@type"] = "file",
          expected_size = 0,
          id = 7,
          ["local"] = {
            ["@type"] = "localFile",
            can_be_deleted = false,
            can_be_downloaded = true,
            downloaded_prefix_size = 0,
            downloaded_size = 0,
            is_downloading_active = false,
            is_downloading_completed = false,
            path = ""
          },
          remote = {
            ["@type"] = "remoteFile",
            id = "AQADBQADvKcxG-t28AEACEIpHSwABEVfAAH9wVzjlK6-AAIC",
            is_uploading_active = false,
            is_uploading_completed = true,
            uploaded_size = 0
          },
          size = 0
        }
      },
      reply_markup_message_id = 0,
      title = "si_anu",
      type = {
        ["@type"] = "chatTypePrivate",
        user_id = 133780085
      },
      unread_count = 1,
      unread_mention_count = 0
    }

Frequently Asked Questions
The Functions

Clone this wiki locally