Updates a group or business channel — its title, name, description, category or photo.

💡 Send the whole chat object with an id. Fields you omit are left unchanged.


Request

method is "setChat".

Field Type Required Description
chat Chat Yes The chat to update. Must contain the id.
app_id String Yes The app the chat belongs to.
reference String Optional Your id for this request. Echoed back in the response.

Commonly set fields inside chat

Field Type Description
id String The chat being updated. Required.
title String Display title of the chat.
name String Short name of the chat.
description String Chat description.
category String Chat category.
photo Object { "id": "<media_id>" } — upload the image first, then reference it by id.

Preconditions

Requirement Why
"Manage Chats" permission Needed to modify chats in the app.
Super admin in the chat Editing chat details requires the highest role.

Response

chatDetails

Field Type Returned Description
method String Yes "chatDetails"
chat Chat Yes The chat as it now stands, with a new version.
app_id String Yes Echoed from the request.
reference String Optional Echoed from the request.

SDKs

SDK Call Callback
Java api.setChat(chat, appId, reference); onChatDetails(Chat chat, String appId)
JavaScript api.setChat(chat, appId, reference); onChatDetails(chat, appId)
Python napi.set_chat(chat=chat, app_id=app_id, reference=reference) on_chat_details(self, chat, app_id)

Example

Request

{
  "method": "setChat",
  "app_id": "90090684293000559",
  "reference": "123456789",
  "chat": {
    "id": "90090684438172188",
    "name": "New Chat",
    "photo": {
      "id": "V_vT9kSn_nullde6c172db6a9b5d9764ea99a1371ed5495d1dda12ffaa56b4b3b55428980b446.jpg"
    }
  }
}
Chat chat = new Chat();
chat.setId("90090684438172188");
chat.setName("New Chat");
api.setChat(chat, "90090684293000559", "123456789");
let chat = new Chat();
chat.id = "90090684438172188";
chat.name = "New Chat!";
api.setChat(chat, "90090684293000559", "123456789");