Zum Inhalt
Für Agenten

chat_channel_save

Create, Update or Archive Chat Channel

Markdown Tools als JSON

Beschreibung

Admins and employers manage public/private channels they can access. Omit id to create; name and workspace_id are required and channel_type defaults to public. The creator joins as a channel admin. Pass a chan_… id to change only supplied fields. Set archived: true to archive or false to restore, preserving messages and memberships. Employers need workspace access; private channels also require channel membership or workspace-manager access. Changing public/private on an existing channel requires an account admin or workspace manager. member_ids replaces a private channel's roster, retaining the creator and acting user if already members. Members must be active and have workspace access. Omit member_ids to preserve the roster; [] removes other members. Restore an archived channel before changing its roster. Public-channel agents are assigned through workspace settings. Agents in private rosters must already be deployed to the workspace. Channels cannot move workspace here. Restore an archived workspace before managing its channels. DMs use chat_start_dm. Discover IDs and archived channels with chat_list_channels.

Zugriff

Zugriffsprofil: gated. Module: chat. Die Freigabe im Profil ersetzt keine Account-, Workspace- oder Rollenberechtigung.

Parameter

Name Typ Pflicht Beschreibung
account_id string Ja Account prefix ID (acct_…).
id string Nein Channel prefix ID (chan_…). Omit to create.
workspace_id string Nein Required on create: workspace prefix ID (wsp_…) or key. Immutable on update.
name string Nein Required on create; at most 100 characters.
description string / null Nein Plain text. Null or an empty string clears it.
channel_type string Nein
archived boolean Nein Existing channel only: true archives, false restores.
member_ids array Nein Private channels only: complete desired roster of user_… IDs or @handles. Creator and existing acting member are retained.

Eingabeschema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "account_id": {
      "type": "string",
      "description": "Account prefix ID (acct_…)."
    },
    "id": {
      "type": "string",
      "description": "Channel prefix ID (chan_…). Omit to create."
    },
    "workspace_id": {
      "type": "string",
      "description": "Required on create: workspace prefix ID (wsp_…) or key. Immutable on update."
    },
    "name": {
      "type": "string",
      "description": "Required on create; at most 100 characters."
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Plain text. Null or an empty string clears it."
    },
    "channel_type": {
      "type": "string",
      "enum": [
        "public",
        "private"
      ]
    },
    "archived": {
      "type": "boolean",
      "description": "Existing channel only: true archives, false restores."
    },
    "member_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Private channels only: complete desired roster of user_… IDs or @handles. Creator and existing acting member are retained."
    }
  },
  "required": [
    "account_id"
  ],
  "type": "object"
}

Ausgabeschema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "channel": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Channel prefix ID (chan_…) — pass to chat_get_messages / chat_send_message."
        },
        "workspace_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Null for account-wide DMs."
        },
        "name": {
          "type": "string"
        },
        "channel_type": {
          "type": "string",
          "enum": [
            "public",
            "private",
            "direct"
          ]
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "is_archived": {
          "type": "boolean"
        },
        "last_message_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 8601 timestamp; null if no messages yet."
        },
        "is_member": {
          "type": "boolean",
          "description": "Whether the caller is a member of this channel."
        },
        "member_ids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Current roster as user_… prefix IDs."
        }
      },
      "required": [
        "id",
        "workspace_id",
        "name",
        "channel_type",
        "is_archived",
        "is_member"
      ]
    }
  },
  "required": [
    "channel"
  ],
  "type": "object"
}
Seiten