GramJS

account.UpdateProfile

Updates user profile.

Example

const { Api, TelegramClient } = require("telegram");
const { StringSession } = require("telegram/sessions");

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result = await client.invoke(
    new Api.account.UpdateProfile({
      firstName: "some string here",
      lastName: "some string here",
      about: "some string here",
    })
  );
  console.log(result); // prints the result
})();
import { Api, TelegramClient } from "telegram";
import { StringSession } from "telegram/sessions";

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result: Api.User = await client.invoke(
    new Api.account.UpdateProfile({
      firstName: "some string here",
      lastName: "some string here",
      about: "some string here",
    })
  );
  console.log(result); // prints the result
})();

Parameters

NameTypeDescription
flags#Flags, see TL conditional fields
firstNameflags.0?stringNew user first name
lastNameflags.1?stringNew user last name
aboutflags.2?stringNew bio

Result

Returns User object containing the updated current user profile.

Possible errors

CodeTypeDescription
400ABOUT_TOO_LONGAbout string too long
400FIRSTNAME_INVALIDThe first name is invalid

Can bots use this method?

No