Skip to content

importContacts

Sahri Riza Umami edited this page Jun 25, 2018 · 4 revisions

Adds new contacts or edits existing contacts; contacts' user identifiers are ignored.

importContacts(phone_number, first_name, last_name, user_id, callback, data)
Field Type Description
phone_number string Phone number of the user.
first_name string First name of the user; 1-255 characters in length.
last_name string Last name of the user.
user_id int32 Identifier of the user, if known; otherwise 0.

Example

  • Adds Si Anu to existing contacts.

    importContacts('621234567890', 'Si', 'Anu', 0)

    Response:

    {
      ["@type"] = "updateUser",
      user = {
        ["@type"] = "user",
        first_name = "Si",
        have_access = true,
        id = 133780085,
        incoming_link = {
          ["@type"] = "linkStateNone"
        },
        is_verified = false,
        language_code = "",
        last_name = "Anu",
        outgoing_link = {
          ["@type"] = "linkStateIsContact"
        },
        phone_number = "621234567890",
        profile_photo = {
          ["@type"] = "profilePhoto",
          big = {
            ["@type"] = "file",
            expected_size = 0,
            id = 21,
            ["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
          },
          id = "139742340594116540",
          small = {
            ["@type"] = "file",
            expected_size = 0,
            id = 20,
            ["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
          }
        },
        restriction_reason = "",
        status = {
          ["@type"] = "userStatusOffline",
          was_online = 1519060216
        },
        type = {
          ["@type"] = "userTypeRegular"
        },
        username = "si_anu"
      }
    }

Frequently Asked Questions
The Functions

Clone this wiki locally