# Post through an incoming webhook

> Posts `text` to the channel the webhook was made for, as the app.

**POST** `/api/public/apps/hooks/{token}`

Needs the `incoming-webhook` permission on the app. The secret URL is the credential: send no token.

Posts `text` to the channel the webhook was made for, as the app. The body matches Slack's, so existing tools work: without `text`, Slack's `attachments` (`pretext`, `title`, `text`, `fields`) become the text.

## Parameters

| Name | In | Required | Meaning |
| --- | --- | --- | --- |
| `token` | path | yes | string |

## Body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `text` | string | no | Up to 8000 characters. |
| `attachments` | array of object | no | Used only when `text` is missing. |

## Example

**curl**

```sh
curl -X POST "https://amedeus.app/api/public/apps/hooks/<secret>" \
  -H 'Content-Type: application/json' \
  -d '{}'
```

**JavaScript**

```js
const response = await fetch("https://amedeus.app/api/public/apps/hooks/<secret>", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({}),
});
const result = await response.json(); // { ok: true, … } or { ok: false, error, message }
```

**Python**

```python

request = urllib.request.Request(
    "https://amedeus.app/api/public/apps/hooks/<secret>",
    data=json.dumps({}).encode(),
    headers={
        "Content-Type": "application/json",
        "User-Agent": "my-app/1.0",
    },
    method="POST",
)
with urllib.request.urlopen(request) as response:
    result = json.load(response)  # a 4xx or 5xx raises urllib.error.HTTPError
```

## Response

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `ok` | `true` | yes |  |
| `id` | uuid | yes |  |

```json
{
  "ok": true,
  "id": "52f4c823-8e7f-4349-bb98-1ac8683aad13"
}
```

## Errors

Failures answer `{ "ok": false, "error": "<code>", "message": "…" }`; see [Errors](/reference/errors/).

- `400`: The request isn't valid.
- `404`: The URL is wrong or was replaced.
- `429`: Slow down; `Retry-After` says for how many seconds.

