> ## 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 Slack message

> Deprecated: create a composition and send it with `POST /v1/compositions/{composition_id}/deliver` instead, which can also schedule it and DM groups, feeds and event registrants.

Posts to a channel, sends direct messages, or both. The message goes out immediately and cannot be unsent. It is recorded as a composition, `composition_id`, and goes out through the same paced, retried delivery a composition's does; the response waits up to 20 seconds for it, then answers with `status` saying how far it got.

A refusal carries one of these `code` values:

- `invalid_blocks` (400): Slack or the Block Kit check rejected the blocks.
- `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.
- `thread_not_found` (422): No message in the channel has this `thread_ts`.
- `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 Slack message
      description: >-
        Deprecated: create a composition and send it with `POST
        /v1/compositions/{composition_id}/deliver` instead, which can also
        schedule it and DM groups, feeds and event registrants.


        Posts to a channel, sends direct messages, or both. The message goes out
        immediately and cannot be unsent. It is recorded as a composition,
        `composition_id`, and goes out through the same paced, retried delivery
        a composition's does; the response waits up to 20 seconds for it, then
        answers with `status` saying how far it got.


        A refusal carries one of these `code` values:


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

        - `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.

        - `thread_not_found` (422): No message in the channel has this
        `thread_ts`.

        - `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'
      deprecated: true
      security:
        - Bearer: []
components:
  schemas:
    SlackMessageCreate:
      type: object
      properties:
        channel_id:
          type: string
          pattern: ^[CG][A-Z0-9]{8,20}$
          description: >-
            Slack’s id for the channel to post in, such as `C0123456789`. 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: 1000
          description: >-
            Members to also send the message to as a direct message from the
            app, one each, up to 1000. A profile's `slack_profile_id`. One who
            is not a member the app can message is left out and listed in
            `failed_dm_slack_profile_ids`.
        text:
          type: string
          minLength: 1
          maxLength: 3000
          description: >-
            The message as Slack `mrkdwn`, sent as a single section block. At
            most 3000 UTF-16 code units; most emoji count as two or more. 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`.
        composition_id:
          type: string
          example: cmps_7h2k9m4n1p6q
          description: >-
            The composition the send is recorded as. `GET
            /v1/compositions/{composition_id}?expand=deliveries` follows it,
            which is how to find out how a send answered `sending` ended.
        status:
          type: string
          enum:
            - sent
            - partially_sent
            - sending
          example: sent
          description: >-
            How far the send got before the response. One of:

            - `sent`: everything reached Slack.

            - `partially_sent`: the send finished, but some of it did not reach
            Slack, or Slack could not confirm it did: a channel post with a
            `null` `ts`, or the members in `failed_dm_slack_profile_ids`.

            - `sending`: it is still going out. `ts` is set once the channel
            post has landed, and `failed_dm_slack_profile_ids` names only the
            misses known so far.


            Whatever the status, sending again repeats what already went out.
        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, before the post has landed, or when it
            did not.
        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, including those
            who are not members the app can message, or whose message Slack
            could not confirm. The rest of the send went out, so sending again
            would repeat it.
      required:
        - object
        - composition_id
        - status
        - 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.
        used_by:
          type: array
          items:
            type: object
            properties:
              object:
                type: string
                description: The type of the object that uses it.
                example: event
              id:
                type:
                  - string
                  - 'null'
                description: >-
                  The id of the object that uses it. Null for a private Message
                  Blaster message.
                example: cevt_V1StGXR8Z5jd
              field:
                type: string
                description: The field of that object that holds it.
                example: cover_image_file_id
            required:
              - object
              - id
              - field
          description: >-
            Up to 20 objects that use the file. Present only when `code` is
            `file_in_use`.
        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 your Slack workspace](https://docs.tightknit.ai/guides/create-your-slack-workspace.md)
- [Create channels and feeds](https://docs.tightknit.ai/guides/create-your-core-channels.md)
- [Create milestone Slack channel](https://docs.tightknit.ai/v1/api-reference/journeys/create-milestone-slack-channel.md)
- [Create an event](https://docs.tightknit.ai/events/create-event.md)
- [Message Blaster](https://docs.tightknit.ai/studio/message-blaster.md)


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