Open Context Protocol is live! 🚀 Read the launch post

chatUnfurl

Provide custom unfurl behavior for user-posted URLs

Details

  • Method: POST
  • Path: /chat.unfurl
  • Operation ID: chat_unfurl

Parameters

{
  "token": {
    "description": "Authentication token. Requires scope: `links:write`",
    "required": true,
    "location": "header",
    "type": "string"
  },
  "channel": {
    "description": "Channel ID of the message",
    "required": true,
    "location": "formData",
    "type": "string"
  },
  "ts": {
    "description": "Timestamp of the message to add unfurl behavior to.",
    "required": true,
    "location": "formData",
    "type": "string"
  },
  "unfurls": {
    "description": "URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl blocks or message attachments.",
    "required": false,
    "location": "formData",
    "type": "string"
  },
  "user_auth_message": {
    "description": "Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior",
    "required": false,
    "location": "formData",
    "type": "string"
  },
  "user_auth_required": {
    "description": "Set to `true` or `1` to indicate the user must install your Slack app to trigger unfurls for this domain",
    "required": false,
    "location": "formData",
    "type": "string"
  },
  "user_auth_url": {
    "description": "Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded.",
    "required": false,
    "location": "formData",
    "type": "string"
  }
}

Response Schema

{
  "additionalProperties": false,
  "description": "Schema for successful response from chat.unfurl method",
  "properties": {
    "ok": {
      "enum": [
        true
      ],
      "title": "default success response",
      "type": "boolean"
    }
  },
  "required": [
    "ok"
  ],
  "title": "chat.unfurl 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('chatUnfurl', {
    # Add required parameters here
})