Open Context Protocol is live! 🚀 Read the launch post

chatUpdate

Updates a message.

Details

  • Method: POST
  • Path: /chat.update
  • Operation ID: chat_update

Parameters

{
  "token": {
    "description": "Authentication token. Requires scope: `chat:write`",
    "required": true,
    "location": "header",
    "type": "string"
  },
  "as_user": {
    "description": "Pass true to update the message as the authed user. [Bot users](/bot-users) in this context are considered authed users.",
    "required": false,
    "location": "formData",
    "type": "string"
  },
  "attachments": {
    "description": "A JSON-based array of structured attachments, presented as a URL-encoded string. This field is required when not presenting `text`. If you don't include this field, the message's previous `attachments` will be retained. To remove previous `attachments`, include an empty array for this field.",
    "required": false,
    "location": "formData",
    "type": "string"
  },
  "blocks": {
    "description": "A JSON-based array of [structured blocks](/block-kit/building), presented as a URL-encoded string. If you don't include this field, the message's previous `blocks` will be retained. To remove previous `blocks`, include an empty array for this field.",
    "required": false,
    "location": "formData",
    "type": "string"
  },
  "channel": {
    "description": "Channel containing the message to be updated.",
    "required": true,
    "location": "formData",
    "type": "string"
  },
  "link_names": {
    "description": "Find and link channel names and usernames. Defaults to `none`. If you do not specify a value for this field, the original value set for the message will be overwritten with the default, `none`.",
    "required": false,
    "location": "formData",
    "type": "string"
  },
  "parse": {
    "description": "Change how messages are treated. Defaults to `client`, unlike `chat.postMessage`. Accepts either `none` or `full`. If you do not specify a value for this field, the original value set for the message will be overwritten with the default, `client`.",
    "required": false,
    "location": "formData",
    "type": "string"
  },
  "text": {
    "description": "New text for the message, using the [default formatting rules](/reference/surfaces/formatting). It's not required when presenting `blocks` or `attachments`.",
    "required": false,
    "location": "formData",
    "type": "string"
  },
  "ts": {
    "description": "Timestamp of the message to be updated.",
    "required": true,
    "location": "formData",
    "type": "string"
  }
}

Response Schema

{
  "additionalProperties": false,
  "description": "Schema for successful response of chat.update method",
  "properties": {
    "channel": {
      "type": "string"
    },
    "message": {
      "properties": {
        "attachments": {
          "items": {
            "type": "object"
          },
          "type": "array"
        },
        "blocks": {
          "type": "object"
        },
        "text": {
          "type": "string"
        }
      },
      "required": [
        "text"
      ],
      "title": "Message object",
      "type": "object"
    },
    "ok": {
      "enum": [
        true
      ],
      "title": "default success response",
      "type": "boolean"
    },
    "text": {
      "type": "string"
    },
    "ts": {
      "type": "string"
    }
  },
  "required": [
    "ok",
    "channel",
    "ts",
    "text",
    "message"
  ],
  "title": "chat.update success schema",
  "type": "object"
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('slack')

# Call this tool
result = await agent.call_tool('chatUpdate', {
    # Add required parameters here
})