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

# Create a Slack message

> Posts to a channel, sends direct messages, or both. The message goes out immediately and cannot be unsent.

A refusal carries one of these `code` values:

- `invalid_blocks` (400): Slack or the Block Kit check rejected the blocks.
- `no_recipients` (400): Neither `channel_id` nor `dm_slack_profile_ids` was given.
- `too_many_dm_recipients` (400): More direct-message recipients than one request allows.
- `channel_not_found` (422): The channel is not in the Slack workspace.
- `not_in_channel` (422): The Tightknit app is not in the channel and could not join it.
- `channel_not_allowed` (422): The channel is private and the Tightknit app is not in it, or it is archived, a direct message, or the Tightknit Hub.
- `cannot_publish` (422): The channel's feed does not accept site posts.
- `dm_delivery_failed` (422): No direct message could be delivered.
- `no_workspace` (409): Slack is not connected to the community.
- `no_community` (409): A `community` send, but the community has no name configured.
- `missing_scope` (409): The Slack app lacks a permission the send needs; reconnect Slack.
- `slack_unavailable` (503): Slack could not be reached; retry later.



## OpenAPI

````yaml /openapi-v1.json post /v1/slack_messages
openapi: 3.1.0
info:
  title: Tightknit Admin API
  version: 1.0.0
  description: Administrative access to a Tightknit community.
servers:
  - url: https://api.tightknit.ai
security:
  - Bearer: []
tags:
  - name: API keys
    description: Inspect the key a request authenticated with.
  - name: Awards
    description: Badges and certificates a community grants its members.
  - name: Events
    description: Read, create, update and delete events on the community calendar.
  - name: Journeys
    description: Read multi-step member programs and their milestones.
  - name: Tags
    description: The labels that classify events and content resources.
  - name: Groups
    description: The segments a community sorts its members into.
  - name: Content
    description: >-
      The collections a community files its content under, and the links and
      events in them.
  - name: Feeds
    description: The Slack channels and site-only spaces a community posts in.
  - name: Files
    description: Images and documents a community has uploaded.
  - name: Messages
    description: What a community has published.
  - name: Members
    description: The people in a community.
  - name: Slack messages
    description: >-
      Messages sent to Slack. Sending is the only operation: they cannot be
      read, edited or deleted here.
  - name: Compositions
    description: >-
      Message Blaster drafts: messages saved in Studio before, and kept after,
      they are sent to Slack channels and members. An API key sees only the
      compositions shared with every Studio user.
  - name: Follows
    description: What a member follows.
  - name: Polls
    description: The questions a community puts to its members in Slack.
  - name: Activity logs
    description: What members did in the community, and when.
  - name: System
    description: Service health.
paths:
  /v1/slack_messages:
    post:
      tags:
        - Slack messages
      summary: Create a Slack message
      description: >-
        Posts to a channel, sends direct messages, or both. The message goes out
        immediately and cannot be unsent.


        A refusal carries one of these `code` values:


        - `invalid_blocks` (400): Slack or the Block Kit check rejected the
        blocks.

        - `no_recipients` (400): Neither `channel_id` nor `dm_slack_profile_ids`
        was given.

        - `too_many_dm_recipients` (400): More direct-message recipients than
        one request allows.

        - `channel_not_found` (422): The channel is not in the Slack workspace.

        - `not_in_channel` (422): The Tightknit app is not in the channel and
        could not join it.

        - `channel_not_allowed` (422): The channel is private and the Tightknit
        app is not in it, or it is archived, a direct message, or the Tightknit
        Hub.

        - `cannot_publish` (422): The channel's feed does not accept site posts.

        - `dm_delivery_failed` (422): No direct message could be delivered.

        - `no_workspace` (409): Slack is not connected to the community.

        - `no_community` (409): A `community` send, but the community has no
        name configured.

        - `missing_scope` (409): The Slack app lacks a permission the send
        needs; reconnect Slack.

        - `slack_unavailable` (503): Slack could not be reached; retry later.
      operationId: createSlackMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SlackMessageCreate'
      responses:
        '200':
          description: Success
          headers:
            Request-Id:
              description: Identifier for this request, quote it in support tickets.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SlackMessage'
        default:
          description: Error
          headers:
            Request-Id:
              description: Identifier for this request, quote it in support tickets.
              schema:
                type: string
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      security:
        - Bearer: []
components:
  schemas:
    SlackMessageCreate:
      type: object
      properties:
        channel_id:
          type: string
          pattern: ^[CG][A-Z0-9]{8,20}$
          description: >-
            The channel to post in. A private channel must have the Tightknit
            app in it; the app joins a public channel it cannot otherwise post
            to.
        dm_slack_profile_ids:
          type: array
          items:
            type: string
            pattern: ^[UW][A-Z0-9]{8,20}$
          minItems: 1
          maxItems: 50
          description: >-
            Members to also send the message to as a direct message from the
            app, one each. A profile's `slack_profile_id`.
        text:
          type: string
          minLength: 1
          maxLength: 3000
          description: >-
            The message as Slack `mrkdwn`, sent as a single section block. Send
            this or `blocks`.
        blocks:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                description: The Block Kit block type, such as `section`.
            required:
              - type
            additionalProperties: {}
          minItems: 1
          maxItems: 50
          description: >-
            The message as a Slack Block Kit payload, which Slack validates.
            Send this or `text`.
        identity:
          type: string
          enum:
            - community
            - bot
          default: community
          description: |-
            Who the channel message is posted as. One of:
            - `community`: the app under the community name and logo.
            - `bot`: the app itself.
        thread_ts:
          type: string
          pattern: ^\d{10}\.\d{6}$
          description: Post as a reply in this message's thread, in the same channel.
        publish_to_site:
          type: boolean
          description: >-
            Also publish the channel message to the community site, when the
            channel's feed accepts posts.
      additionalProperties: false
    SlackMessage:
      type: object
      properties:
        object:
          type: string
          enum:
            - slack_message
          description: Always `slack_message`.
        channel_id:
          anyOf:
            - type: string
            - type: 'null'
          example: C01ABC123
          description: >-
            Slack’s id for the channel the message was posted in. `null` when
            the message went out only as direct messages.
        ts:
          anyOf:
            - type: string
            - type: 'null'
          example: '1718000042.000123'
          description: >-
            The channel message's Slack timestamp. `null` when the message went
            out only as direct messages.
        message_id:
          anyOf:
            - type: string
            - type: 'null'
          example: msg_9f2b8c1d4e5a
          description: The community site post, when `publish_to_site` created one.
        failed_dm_slack_profile_ids:
          type: array
          items:
            type: string
          example:
            - U0BRY4S6LNQ
          description: >-
            Direct message recipients the message did not reach. The rest of the
            send went out, so sending again would repeat it.
      required:
        - object
        - channel_id
        - ts
        - message_id
        - failed_dm_slack_profile_ids
    Problem:
      type: object
      properties:
        type:
          type: string
          description: A URI naming the problem type. Always `about:blank`.
          example: about:blank
        title:
          type: string
          description: A short summary of the HTTP status.
          example: Not found
        status:
          type: integer
          description: The HTTP status code.
          example: 404
        detail:
          type: string
          description: What went wrong with this request, when there is more to say.
        code:
          type: string
          description: >-
            A stable, machine-readable error code to branch on, unlike `title`
            and `detail`.
          example: not_found
        param:
          type: string
          description: The request field or parameter the error is about, when one is.
        request_id:
          type: string
          description: >-
            The id of the request, also sent as the `Request-Id` header. Quote
            it in support tickets.
          example: req_9f2b8c1d4e5a6b7c8d9e0f1a2b3c4d5e
      required:
        - type
        - title
        - status
        - code
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: Tightknit API key
      description: 'A Tightknit admin API key, sent as `Authorization: Bearer <key>`.'

````

## Related topics

- [Create Channels and Feeds](https://docs.tightknit.ai/guides/create-your-core-channels.md)
- [Create Your Slack Workspace](https://docs.tightknit.ai/guides/create-your-slack-workspace.md)
- [Message Blaster](https://docs.tightknit.ai/studio/message-blaster.md)
- [Create a milestone Slack channel](https://docs.tightknit.ai/v1/api-reference/journeys/create-a-milestone-slack-channel.md)
- [Slack Sync Guide](https://docs.tightknit.ai/slack/sync-guide.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.