> ## Documentation Index
> Fetch the complete documentation index at: https://www.plain.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a thread from a Slack message

> Create a thread from a top-level Slack message in a connected customer channel.

`createThreadFromSlackMessage` creates a thread from a top-level message in a connected customer Slack channel. The thread includes the replies Plain has already received for that message. It is the trigger for [API-only ingestion](/docs/product/channels/slack-ingestion-modes#api-only), and it works in every other [ingestion mode](/docs/product/channels/slack-ingestion-modes) too.

<Snippet file="graphql/sdk-note.mdx" />

The channel must already be connected in **Settings → Slack**, enabled, and set as a customer channel. Pass `slackChannelId` and `slackMessageTimestamp`. Replies are rejected.

You need an API key with the `thread:create` permission.

<Snippet file="graphql/create-thread-from-slack-message.mdx" />

## Getting the created thread

Ingestion runs asynchronously. The mutation returns `thread` only when that Slack message was already a thread. When the request is accepted and the thread is still being created, `thread` is null and `error` is null.

Fetch the thread with `threadBySlackPermalink`, or subscribe to [`thread.thread_created`](/docs/webhooks/thread-created). Calling the mutation again for the same message returns the existing thread rather than creating a second one.

<Snippet file="graphql/get-thread-by-slack-permalink.mdx" />

`threadBySlackPermalink` returns null until the thread exists. The permalink is the Slack link to the top-level message.

## Messages the mutation rejects

The mutation returns `cannot_create_thread_from_slack_message` when:

* The Slack channel is not connected to this workspace
* The connected channel is disabled
* The connected channel is not a customer channel
* The message is a reply rather than a top-level message

## After the thread exists

Replies in that Slack thread attach to the Plain thread. New top-level messages in an API-only channel do not become threads until you call the mutation again.
