Open Context Protocol is live! 🚀 Read the launch post
conversationsHistory

conversationsHistory

Fetches a conversation’s history of messages and events.

Details

  • Method: GET
  • Path: /conversations.history
  • Operation ID: conversations_history

Parameters

{
  "token": {
    "description": "Authentication token. Requires scope: `conversations:history`",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "channel": {
    "description": "Conversation ID to fetch history for.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "latest": {
    "description": "End of time range of messages to include in results.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "oldest": {
    "description": "Start of time range of messages to include in results.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "inclusive": {
    "description": "Include messages with latest or oldest timestamp in results only when either timestamp is specified.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "limit": {
    "description": "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "cursor": {
    "description": "Paginate through collections of data by setting the `cursor` parameter to a `next_cursor` attribute returned by a previous request's `response_metadata`. Default value fetches the first \"page\" of the collection. See [pagination](/docs/pagination) for more detail.",
    "required": false,
    "location": "query",
    "type": "string"
  }
}

Response Schema

{
  "additionalProperties": false,
  "description": "Schema for successful response from conversations.history method",
  "properties": {
    "channel_actions_count": {
      "type": "integer"
    },
    "channel_actions_ts": {
      "items": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "has_more": {
      "type": "boolean"
    },
    "messages": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "attachments": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "fallback": {
                  "type": "string"
                },
                "id": {
                  "type": "integer"
                },
                "image_bytes": {
                  "type": "integer"
                },
                "image_height": {
                  "type": "integer"
                },
                "image_url": {
                  "type": "string"
                },
                "image_width": {
                  "type": "integer"
                }
              },
              "required": [
                "id"
              ],
              "type": "object"
            },
            "minItems": 1,
            "type": "array",
            "uniqueItems": true
          },
          "blocks": {
            "description": "This is a very loose definition, in the future, we'll populate this with deeper schema in this definition namespace.",
            "items": {
              "additionalProperties": true,
              "properties": {
                "type": {
                  "type": "string"
                }
              },
              "required": [
                "type"
              ],
              "type": "object"
            },
            "title": "Block Kit blocks",
            "type": "array"
          },
          "bot_id": {
            "items": [
              {
                "pattern": "^B[A-Z0-9]{8,}$",
                "title": "Bot User ID",
                "type": "string"
              },
              {
                "title": "Nil bot_id set when display_as_bot is false",
                "type": "null"
              }
            ]
          },
          "bot_profile": {
            "additionalProperties": false,
            "properties": {
              "app_id": {
                "pattern": "^A[A-Z0-9]{1,}$",
                "title": "App ID",
                "type": "string"
              },
              "deleted": {
                "type": "boolean"
              },
              "icons": {
                "additionalProperties": false,
                "properties": {
                  "image_36": {
                    "format": "uri",
                    "type": "string"
                  },
                  "image_48": {
                    "format": "uri",
                    "type": "string"
                  },
                  "image_72": {
                    "format": "uri",
                    "type": "string"
                  }
                },
                "required": [
                  "image_36",
                  "image_48",
                  "image_72"
                ],
                "type": "object"
              },
              "id": {
                "pattern": "^B[A-Z0-9]{8,}$",
                "title": "Bot User ID",
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "team_id": {
                "pattern": "^[T][A-Z0-9]{2,}$",
                "title": "Team ID",
                "type": "string"
              },
              "updated": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "deleted",
              "name",
              "updated",
              "app_id",
              "icons",
              "team_id"
            ],
            "title": "Bot Profile Object",
            "type": "object"
          },
          "client_msg_id": {
            "type": "string"
          },
          "comment": {
            "additionalProperties": false,
            "properties": {
              "comment": {
                "type": "string"
              },
              "created": {
                "type": "integer"
              },
              "id": {
                "pattern": "^Fc[A-Z0-9]{8,}$",
                "title": "File Comment ID",
                "type": "string"
              },
              "is_intro": {
                "type": "boolean"
              },
              "is_starred": {
                "type": "boolean"
              },
              "num_stars": {
                "type": "integer"
              },
              "pinned_info": {
                "additionalProperties": false,
                "title": "Info for a pinned item",
                "type": "object"
              },
              "pinned_to": {
                "items": {
                  "pattern": "^[CGD][A-Z0-9]{8,}$",
                  "title": "Channel-like conversation ID",
                  "type": "string"
                },
                "type": "array"
              },
              "reactions": {
                "items": {
                  "additionalProperties": true,
                  "properties": {
                    "count": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "users": {
                      "items": {
                        "pattern": "^[UW][A-Z0-9]{2,}$",
                        "title": "User ID",
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "name",
                    "users",
                    "count"
                  ],
                  "title": "Reaction object",
                  "type": "object"
                },
                "type": "array"
              },
              "timestamp": {
                "type": "integer"
              },
              "user": {
                "pattern": "^[UW][A-Z0-9]{2,}$",
                "title": "User ID",
                "type": "string"
              }
            },
            "required": [
              "id",
              "created",
              "timestamp",
              "user",
              "is_intro",
              "comment"
            ],
            "title": "File Comment Object",
            "type": "object"
          },
          "display_as_bot": {
            "type": "boolean"
          },
          "file": {
            "additionalProperties": false,
            "properties": {
              "channels": {
                "items": {
                  "pattern": "^[C][A-Z0-9]{2,}$",
                  "title": "Channel ID",
                  "type": "string"
                },
                "type": "array",
                "uniqueItems": true
              },
              "comments_count": {
                "type": "integer"
              },
              "created": {
                "type": "integer"
              },
              "date_delete": {
                "type": "integer"
              },
              "display_as_bot": {
                "type": "boolean"
              },
              "editable": {
                "type": "boolean"
              },
              "editor": {
                "pattern": "^[UW][A-Z0-9]{2,}$",
                "title": "User ID",
                "type": "string"
              },
              "external_id": {
                "type": "string"
              },
              "external_type": {
                "type": "string"
              },
              "external_url": {
                "format": "uri",
                "type": "string"
              },
              "filetype": {
                "type": "string"
              },
              "groups": {
                "items": {
                  "pattern": "^[G][A-Z0-9]{8,}$",
                  "title": "Private Channel ID",
                  "type": "string"
                },
                "type": "array",
                "uniqueItems": true
              },
              "has_rich_preview": {
                "type": "boolean"
              },
              "id": {
                "pattern": "^[F][A-Z0-9]{8,}$",
                "title": "File ID",
                "type": "string"
              },
              "image_exif_rotation": {
                "type": "integer"
              },
              "ims": {
                "items": {
                  "pattern": "^[D][A-Z0-9]{8,}$",
                  "title": "Direct Message Channel ID",
                  "type": "string"
                },
                "type": "array",
                "uniqueItems": true
              },
              "is_external": {
                "type": "boolean"
              },
              "is_public": {
                "type": "boolean"
              },
              "is_starred": {
                "type": "boolean"
              },
              "is_tombstoned": {
                "type": "boolean"
              },
              "last_editor": {
                "pattern": "^[UW][A-Z0-9]{2,}$",
                "title": "User ID",
                "type": "string"
              },
              "mimetype": {
                "type": "string"
              },
              "mode": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "non_owner_editable": {
                "type": "boolean"
              },
              "num_stars": {
                "type": "integer"
              },
              "original_h": {
                "type": "integer"
              },
              "original_w": {
                "type": "integer"
              },
              "permalink": {
                "format": "uri",
                "type": "string"
              },
              "permalink_public": {
                "format": "uri",
                "type": "string"
              },
              "pinned_info": {
                "additionalProperties": false,
                "title": "Info for a pinned item",
                "type": "object"
              },
              "pinned_to": {
                "items": {
                  "pattern": "^[CGD][A-Z0-9]{8,}$",
                  "title": "Channel-like conversation ID",
                  "type": "string"
                },
                "type": "array"
              },
              "pretty_type": {
                "type": "string"
              },
              "preview": {
                "type": "string"
              },
              "public_url_shared": {
                "type": "boolean"
              },
              "reactions": {
                "items": {
                  "additionalProperties": true,
                  "properties": {
                    "count": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "users": {
                      "items": {
                        "pattern": "^[UW][A-Z0-9]{2,}$",
                        "title": "User ID",
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "name",
                    "users",
                    "count"
                  ],
                  "title": "Reaction object",
                  "type": "object"
                },
                "type": "array"
              },
              "shares": {
                "additionalProperties": false,
                "properties": {
                  "private": {
                    "additionalProperties": false
                  },
                  "public": {
                    "additionalProperties": false
                  }
                },
                "type": "object"
              },
              "size": {
                "type": "integer"
              },
              "source_team": {
                "pattern": "^[T][A-Z0-9]{2,}$",
                "title": "Team ID",
                "type": "string"
              },
              "state": {
                "type": "string"
              },
              "thumb_1024": {
                "format": "uri",
                "type": "string"
              },
              "thumb_1024_h": {
                "type": "integer"
              },
              "thumb_1024_w": {
                "type": "integer"
              },
              "thumb_160": {
                "format": "uri",
                "type": "string"
              },
              "thumb_360": {
                "format": "uri",
                "type": "string"
              },
              "thumb_360_h": {
                "type": "integer"
              },
              "thumb_360_w": {
                "type": "integer"
              },
              "thumb_480": {
                "format": "uri",
                "type": "string"
              },
              "thumb_480_h": {
                "type": "integer"
              },
              "thumb_480_w": {
                "type": "integer"
              },
              "thumb_64": {
                "format": "uri",
                "type": "string"
              },
              "thumb_720": {
                "format": "uri",
                "type": "string"
              },
              "thumb_720_h": {
                "type": "integer"
              },
              "thumb_720_w": {
                "type": "integer"
              },
              "thumb_80": {
                "format": "uri",
                "type": "string"
              },
              "thumb_800": {
                "format": "uri",
                "type": "string"
              },
              "thumb_800_h": {
                "type": "integer"
              },
              "thumb_800_w": {
                "type": "integer"
              },
              "thumb_960": {
                "format": "uri",
                "type": "string"
              },
              "thumb_960_h": {
                "type": "integer"
              },
              "thumb_960_w": {
                "type": "integer"
              },
              "thumb_tiny": {
                "type": "string"
              },
              "timestamp": {
                "type": "integer"
              },
              "title": {
                "type": "string"
              },
              "updated": {
                "type": "integer"
              },
              "url_private": {
                "format": "uri",
                "type": "string"
              },
              "url_private_download": {
                "format": "uri",
                "type": "string"
              },
              "user": {
                "type": "string"
              },
              "user_team": {
                "pattern": "^[T][A-Z0-9]{2,}$",
                "title": "Team ID",
                "type": "string"
              },
              "username": {
                "type": "string"
              }
            },
            "title": "file object",
            "type": "object"
          },
          "files": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "channels": {
                  "items": {
                    "pattern": "^[C][A-Z0-9]{2,}$",
                    "title": "Channel ID",
                    "type": "string"
                  },
                  "type": "array",
                  "uniqueItems": true
                },
                "comments_count": {
                  "type": "integer"
                },
                "created": {
                  "type": "integer"
                },
                "date_delete": {
                  "type": "integer"
                },
                "display_as_bot": {
                  "type": "boolean"
                },
                "editable": {
                  "type": "boolean"
                },
                "editor": {
                  "pattern": "^[UW][A-Z0-9]{2,}$",
                  "title": "User ID",
                  "type": "string"
                },
                "external_id": {
                  "type": "string"
                },
                "external_type": {
                  "type": "string"
                },
                "external_url": {
                  "format": "uri",
                  "type": "string"
                },
                "filetype": {
                  "type": "string"
                },
                "groups": {
                  "items": {
                    "pattern": "^[G][A-Z0-9]{8,}$",
                    "title": "Private Channel ID",
                    "type": "string"
                  },
                  "type": "array",
                  "uniqueItems": true
                },
                "has_rich_preview": {
                  "type": "boolean"
                },
                "id": {
                  "pattern": "^[F][A-Z0-9]{8,}$",
                  "title": "File ID",
                  "type": "string"
                },
                "image_exif_rotation": {
                  "type": "integer"
                },
                "ims": {
                  "items": {
                    "pattern": "^[D][A-Z0-9]{8,}$",
                    "title": "Direct Message Channel ID",
                    "type": "string"
                  },
                  "type": "array",
                  "uniqueItems": true
                },
                "is_external": {
                  "type": "boolean"
                },
                "is_public": {
                  "type": "boolean"
                },
                "is_starred": {
                  "type": "boolean"
                },
                "is_tombstoned": {
                  "type": "boolean"
                },
                "last_editor": {
                  "pattern": "^[UW][A-Z0-9]{2,}$",
                  "title": "User ID",
                  "type": "string"
                },
                "mimetype": {
                  "type": "string"
                },
                "mode": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "non_owner_editable": {
                  "type": "boolean"
                },
                "num_stars": {
                  "type": "integer"
                },
                "original_h": {
                  "type": "integer"
                },
                "original_w": {
                  "type": "integer"
                },
                "permalink": {
                  "format": "uri",
                  "type": "string"
                },
                "permalink_public": {
                  "format": "uri",
                  "type": "string"
                },
                "pinned_info": {
                  "additionalProperties": false,
                  "title": "Info for a pinned item",
                  "type": "object"
                },
                "pinned_to": {
                  "items": {
                    "pattern": "^[CGD][A-Z0-9]{8,}$",
                    "title": "Channel-like conversation ID",
                    "type": "string"
                  },
                  "type": "array"
                },
                "pretty_type": {
                  "type": "string"
                },
                "preview": {
                  "type": "string"
                },
                "public_url_shared": {
                  "type": "boolean"
                },
                "reactions": {
                  "items": {
                    "additionalProperties": true,
                    "properties": {
                      "count": {
                        "type": "integer"
                      },
                      "name": {
                        "type": "string"
                      },
                      "users": {
                        "items": {
                          "pattern": "^[UW][A-Z0-9]{2,}$",
                          "title": "User ID",
                          "type": "string"
                        },
                        "type": "array"
                      }
                    },
                    "required": [
                      "name",
                      "users",
                      "count"
                    ],
                    "title": "Reaction object",
                    "type": "object"
                  },
                  "type": "array"
                },
                "shares": {
                  "additionalProperties": false,
                  "properties": {
                    "private": {
                      "additionalProperties": false
                    },
                    "public": {
                      "additionalProperties": false
                    }
                  },
                  "type": "object"
                },
                "size": {
                  "type": "integer"
                },
                "source_team": {
                  "pattern": "^[T][A-Z0-9]{2,}$",
                  "title": "Team ID",
                  "type": "string"
                },
                "state": {
                  "type": "string"
                },
                "thumb_1024": {
                  "format": "uri",
                  "type": "string"
                },
                "thumb_1024_h": {
                  "type": "integer"
                },
                "thumb_1024_w": {
                  "type": "integer"
                },
                "thumb_160": {
                  "format": "uri",
                  "type": "string"
                },
                "thumb_360": {
                  "format": "uri",
                  "type": "string"
                },
                "thumb_360_h": {
                  "type": "integer"
                },
                "thumb_360_w": {
                  "type": "integer"
                },
                "thumb_480": {
                  "format": "uri",
                  "type": "string"
                },
                "thumb_480_h": {
                  "type": "integer"
                },
                "thumb_480_w": {
                  "type": "integer"
                },
                "thumb_64": {
                  "format": "uri",
                  "type": "string"
                },
                "thumb_720": {
                  "format": "uri",
                  "type": "string"
                },
                "thumb_720_h": {
                  "type": "integer"
                },
                "thumb_720_w": {
                  "type": "integer"
                },
                "thumb_80": {
                  "format": "uri",
                  "type": "string"
                },
                "thumb_800": {
                  "format": "uri",
                  "type": "string"
                },
                "thumb_800_h": {
                  "type": "integer"
                },
                "thumb_800_w": {
                  "type": "integer"
                },
                "thumb_960": {
                  "format": "uri",
                  "type": "string"
                },
                "thumb_960_h": {
                  "type": "integer"
                },
                "thumb_960_w": {
                  "type": "integer"
                },
                "thumb_tiny": {
                  "type": "string"
                },
                "timestamp": {
                  "type": "integer"
                },
                "title": {
                  "type": "string"
                },
                "updated": {
                  "type": "integer"
                },
                "url_private": {
                  "format": "uri",
                  "type": "string"
                },
                "url_private_download": {
                  "format": "uri",
                  "type": "string"
                },
                "user": {
                  "type": "string"
                },
                "user_team": {
                  "pattern": "^[T][A-Z0-9]{2,}$",
                  "title": "Team ID",
                  "type": "string"
                },
                "username": {
                  "type": "string"
                }
              },
              "title": "file object",
              "type": "object"
            },
            "minItems": 1,
            "type": "array",
            "uniqueItems": true
          },
          "icons": {
            "additionalProperties": false,
            "properties": {
              "emoji": {
                "type": "string"
              },
              "image_64": {
                "format": "uri",
                "type": "string"
              }
            },
            "type": "object"
          },
          "inviter": {
            "pattern": "^[UW][A-Z0-9]{2,}$",
            "title": "User ID",
            "type": "string"
          },
          "is_delayed_message": {
            "type": "boolean"
          },
          "is_intro": {
            "type": "boolean"
          },
          "is_starred": {
            "type": "boolean"
          },
          "last_read": {
            "pattern": "^\\d{10}\\.\\d{6}$",
            "title": "Timestamp in format 0123456789.012345",
            "type": "string"
          },
          "latest_reply": {
            "pattern": "^\\d{10}\\.\\d{6}$",
            "title": "Timestamp in format 0123456789.012345",
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "old_name": {
            "type": "string"
          },
          "parent_user_id": {
            "pattern": "^[UW][A-Z0-9]{2,}$",
            "title": "User ID",
            "type": "string"
          },
          "permalink": {
            "format": "uri",
            "type": "string"
          },
          "pinned_to": {
            "items": {
              "pattern": "^[CGD][A-Z0-9]{8,}$",
              "title": "Channel-like conversation ID",
              "type": "string"
            },
            "type": "array"
          },
          "purpose": {
            "type": "string"
          },
          "reactions": {
            "items": {
              "additionalProperties": true,
              "properties": {
                "count": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "users": {
                  "items": {
                    "pattern": "^[UW][A-Z0-9]{2,}$",
                    "title": "User ID",
                    "type": "string"
                  },
                  "type": "array"
                }
              },
              "required": [
                "name",
                "users",
                "count"
              ],
              "title": "Reaction object",
              "type": "object"
            },
            "type": "array"
          },
          "reply_count": {
            "type": "integer"
          },
          "reply_users": {
            "items": {
              "pattern": "^[UW][A-Z0-9]{2,}$",
              "title": "User ID",
              "type": "string"
            },
            "minItems": 1,
            "type": "array",
            "uniqueItems": true
          },
          "reply_users_count": {
            "type": "integer"
          },
          "source_team": {
            "pattern": "^[TE][A-Z0-9]{8,}$",
            "title": "Team or Enterprise ID",
            "type": "string"
          },
          "subscribed": {
            "type": "boolean"
          },
          "subtype": {
            "type": "string"
          },
          "team": {
            "pattern": "^[TE][A-Z0-9]{8,}$",
            "title": "Team or Enterprise ID",
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "thread_ts": {
            "pattern": "^\\d{10}\\.\\d{6}$",
            "title": "Timestamp in format 0123456789.012345",
            "type": "string"
          },
          "topic": {
            "type": "string"
          },
          "ts": {
            "pattern": "^\\d{10}\\.\\d{6}$",
            "title": "Timestamp in format 0123456789.012345",
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "unread_count": {
            "type": "integer"
          },
          "upload": {
            "type": "boolean"
          },
          "user": {
            "pattern": "^[UW][A-Z0-9]{2,}$",
            "title": "User ID",
            "type": "string"
          },
          "user_profile": {
            "additionalProperties": false,
            "properties": {
              "avatar_hash": {
                "type": "string"
              },
              "display_name": {
                "type": "string"
              },
              "display_name_normalized": {
                "type": "string"
              },
              "first_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "image_72": {
                "format": "uri",
                "type": "string"
              },
              "is_restricted": {
                "type": "boolean"
              },
              "is_ultra_restricted": {
                "type": "boolean"
              },
              "name": {
                "type": "string"
              },
              "real_name": {
                "type": "string"
              },
              "real_name_normalized": {
                "type": "string"
              },
              "team": {
                "pattern": "^[TE][A-Z0-9]{8,}$",
                "title": "Team or Enterprise ID",
                "type": "string"
              }
            },
            "required": [
              "avatar_hash",
              "image_72",
              "first_name",
              "real_name",
              "display_name",
              "team",
              "name",
              "is_restricted",
              "is_ultra_restricted"
            ],
            "type": "object"
          },
          "user_team": {
            "pattern": "^[TE][A-Z0-9]{8,}$",
            "title": "Team or Enterprise ID",
            "type": "string"
          },
          "username": {
            "type": "string"
          }
        },
        "required": [
          "text",
          "type",
          "ts"
        ],
        "title": "Message object",
        "type": "object"
      },
      "minItems": 1,
      "type": "array",
      "uniqueItems": true
    },
    "ok": {
      "enum": [
        true
      ],
      "title": "default success response",
      "type": "boolean"
    },
    "pin_count": {
      "type": "integer"
    }
  },
  "required": [
    "ok",
    "messages",
    "has_more",
    "pin_count",
    "channel_actions_ts",
    "channel_actions_count"
  ],
  "title": "conversations.history 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('conversationsHistory', {
    # Add required parameters here
})