# Slack

Publish messages and thread replies to a Slack channel with the Zernio API, with file uploads, a per-message bot identity, and an inbox that receives DMs and mentions in realtime.

import { Tab, Tabs } from 'fumadocs-ui/components/tabs';


Publish messages and thread replies to a Slack channel with `POST /v1/posts` and `platform: "slack"`.

The same account receives DMs and bot mentions in the inbox, and can start a DM with any member of its workspace.

## Quick reference

| Property | Value |
|----------|-------|
| Content limit | 40,000 characters (Slack truncates silently beyond this) |
| Edit limit | 4,000 characters (longer posts cannot be edited) |
| Media per post | Up to 10 files |
| Formatting | Slack `mrkdwn` |
| Post types | Channel messages, thread replies |
| Scheduling | Yes (Zernio-side; Slack's native scheduler is not used) |
| Threads | Yes (`threadTs`) |
| Link unfurling | Configurable per post |
| Per-message identity | Yes (display name and avatar override) |
| Inbox (DMs) | Yes |
| Start a conversation | Yes (DM any member of the workspace) |
| Inbox (channel messages) | Mentions and threads only, not all chatter |
| Contacts and built-in automations | DMs only |
| Analytics | No (Slack has no public message analytics API) |

## Before you start

Slack requires the Zernio bot app installed in the workspace.

You do not create your own Slack app, host a bot or manage tokens. The user installs Zernio's app through OAuth and you post through the API.

One connected account is one channel. To publish to several channels, connect each one as its own account.

**Public channels** are joined automatically on connect.

**Private channels** need a member to run `/invite @Zernio` in it first, because the bot cannot join a private channel on its own. Until then it does not appear in the channel list.

**Admin approval.** Some workspaces require admin approval for new apps, so Slack may show a "request approval" screen.

**Marketplace-only workspaces.** A workspace can be configured to allow only apps listed in the Slack Marketplace.

Zernio's app is distributed but not yet listed, so Slack says it "has not been reviewed by Slack" during install. That is expected.

## Connect

Call `GET /v1/connect/slack` with `profileId` on [List Slack channels](/connect/list-slack-channels).

With no `pendingDataToken` or `accountId`, it returns the `authUrl` and `state` that start OAuth, like `GET /v1/connect/{platform}` does for other platforms.

The full flow, with code for every step, is on [Connect](/platforms/slack/connect).

## Publish a post

This request sends a message to a Slack channel right away.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: published } = await zernio.posts.createPost({
  body: {
    content: 'Deploy finished :rocket:',
    platforms: [
      { platform: 'slack', accountId: '66b2e19d8c3f5a7e9d0b1c2d' }
    ],
    publishNow: true
  }
});

console.log(published.post.platforms[0].platformPostUrl);
```
</Tab>
<Tab value="Python">
```python
from zernio import Zernio

client = Zernio()

published = client.posts.create_post(
    content="Deploy finished :rocket:",
    platforms=[
        {"platform": "slack", "accountId": "66b2e19d8c3f5a7e9d0b1c2d"}
    ],
    publish_now=True
)

print(published["post"]["platforms"][0]["platformPostUrl"])
```
</Tab>
<Tab value="curl">
```bash
curl -X POST https://zernio.com/api/v1/posts \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Deploy finished :rocket:",
    "platforms": [
      {"platform": "slack", "accountId": "66b2e19d8c3f5a7e9d0b1c2d"}
    ],
    "publishNow": true
  }'
```
</Tab>
</Tabs>

Every option is on [Publish](/platforms/slack/posts).

## In this section

<PlatformPages platform="slack" />

## Related

- [Connecting accounts](/guides/connecting-accounts): the OAuth flow in general.
- [Create post](/posts/create-post) and [Edit post](/posts/edit-post): every field of the request.
- [Slack account settings](/accounts/get-slack-settings): the default message identity for a channel.
- [Messages](/messages/list-inbox-conversations): the inbox API.
- [Account health](/accounts/get-all-accounts-health): verify the connection.
- [Pricing](/pricing): what the inbox and outbound messages cost.