# Slack webhook

Source: https://docs.recoupable.dev/api-reference/content-agent/webhook

Webhook endpoint for the Recoup Content Agent Slack bot. Receives @mention events from Slack and triggers content generation for the mentioned artist.

## POST /api/content-agent/{platform}

Full OpenAPI specification: https://docs.recoupable.dev/spec/content.json

## Authentication

The supplied specification does not declare an OpenAPI security object for this operation. Its declared headers and parameters still apply. Consult the authentication guide and the full specification before calling it.

[Authentication guide](https://docs.recoupable.dev/authentication)

## Operation and referenced schemas

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Recoup API - Content",
    "description": "API documentation for the Recoup platform - an AI agent platform for the music industry",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.recoupable.dev"
    }
  ],
  "paths": {
    "/api/content-agent/{platform}": {
      "post": {
        "operationId": "postContentAgentByPlatform",
        "description": "Webhook endpoint for the Recoup Content Agent Slack bot. Receives @mention events from Slack and triggers content generation for the mentioned artist. The bot parses the mention text for `<artist_account_id> [template] [batch=N] [lipsync]`, validates the artist, calls POST /api/content/create, and starts a background polling task that reports results back to the Slack thread.\n\nFor Slack, also handles `url_verification` challenges during app setup.\n\nSlack supplies `X-Slack-Signature` and `X-Slack-Request-Timestamp`. Setup verification checks the exact raw body with the configured Content Agent app signing secret and accepts timestamps within five minutes of the server clock. A valid `url_verification` request returns the JSON challenge; missing or invalid setup signatures, an out-of-window timestamp, or an unavailable app signing secret return `401` with plain-text `Unauthorized`. Ordinary events continue through the existing Slack adapter.",
        "parameters": [
          {
            "name": "platform",
            "in": "path",
            "description": "Chat platform identifier. Currently supports `slack`.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "slack"
              ]
            }
          },
          {
            "name": "X-Slack-Signature",
            "in": "header",
            "required": true,
            "description": "Slack-generated signature for this request. Recoup verifies it with the Content Agent app signing secret; send the computed signature, never the signing secret itself.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Slack-Request-Timestamp",
            "in": "header",
            "required": true,
            "description": "Slack-generated Unix timestamp in seconds. Setup verification rejects timestamps more than five minutes before or after the server clock.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Slack Events API payload (app_mention event or url_verification challenge)",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Slack Events API envelope — the shape depends on the event type"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A verified setup challenge is echoed as JSON. Ordinary JSON event callbacks receive the Slack adapter's plain-text ok acknowledgement; this acknowledges receipt while content generation continues separately.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "challenge": {
                      "type": "string",
                      "description": "Echo of the verified Slack setup challenge."
                    }
                  },
                  "required": [
                    "challenge"
                  ]
                },
                "examples": {
                  "verifiedSetup": {
                    "summary": "Verified setup challenge",
                    "value": {
                      "challenge": "example-challenge"
                    }
                  }
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "example": "ok"
              }
            }
          },
          "401": {
            "description": "Slack signature verification failed. Setup challenges use plain-text Unauthorized for missing or invalid signatures, timestamps outside the five-minute window, or an unavailable configured signing secret. The existing adapter handles ordinary event authentication and currently uses plain-text Invalid signature.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "examples": {
                  "setupChallenge": {
                    "summary": "Setup signature rejected",
                    "value": "Unauthorized"
                  },
                  "ordinaryEvent": {
                    "summary": "Event signature rejected by the adapter",
                    "value": "Invalid signature"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown platform"
          }
        }
      }
    }
  }
}
```
