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

# Add a Slack channel

> Send the workspace's notifications to a Slack channel.

> [!NOTE]
>
> Needs `notifications:create`, and a role that can manage notifications (owners and managers). See [Permissions](https://docs.postsyncer.com/essentials/authentication.md#permissions).

Takes the connected Slack workspace (`installation_id`), a channel from [List Slack channels](https://docs.postsyncer.com/api-reference/notifications/slack-channels.md) and the `events` it gets (any of `team_chat_events`). The name defaults to `#` and the channel name. Approval requests carry Approve and Reject buttons unless `approve_buttons` is `false`.

Discord and Telegram channels are added with [Create a connect link](https://docs.postsyncer.com/api-reference/notifications/connect-link.md). Webhook endpoints are made with [Create a webhook](https://docs.postsyncer.com/api-reference/webhooks/create.md).

## Errors

| Status | When | Retry? |
| - | - | - |
| 401 | No API key, or not a valid one. | No: fix the key. |
| 403 | The key lacks `notifications:create`, its user is inactive, or your role can't manage notifications. | No. |
| 422 | A `kind` other than `slack`, Slack isn't connected to this workspace, Slack doesn't know the channel, or an event a channel can't get. | No. |
| 429 | More than 60 requests a minute. | Yes, after `Retry-After` seconds. |


## OpenAPI

````yaml POST /notification-destinations
openapi: 3.0.3
info:
  title: PostSyncer API
  description: >-
    Post to 12 social networks from your code: posts, media, comments,
    analytics, webhooks and more.
  version: 1.0.0
servers:
  - url: https://postsyncer.com/api/v1
security:
  - bearerAuth: []
tags:
  - name: Workspaces
    description: The workspaces the key can reach.
  - name: Accounts
    description: Connected social accounts, links to connect more, and disconnecting them.
  - name: Posts
    description: Drafts, scheduled and published posts, approvals and a post's history.
  - name: Post settings
    description: A post's auto-plug, comment moderation and contact collection.
  - name: Media
    description: >-
      The media library: file uploads, URL imports, and reading videos and
      social posts' files.
  - name: Folders
    description: Folders that organise the media library.
  - name: Comments
    description: >-
      Comments on your posts: reading, replying, editing, hiding, deleting and
      syncing them.
  - name: Reviews
    description: Google Business Profile reviews and your replies to them.
  - name: Analytics
    description: Workspace, account and post performance.
  - name: Brand
    description: >-
      A workspace's brand: identity, voice, look, accounts, competitors,
      learnings and rules.
  - name: Labels
    description: Labels used to tag posts.
  - name: Campaigns
    description: Campaigns used to group posts.
  - name: Snippets
    description: Saved snippets and hashtag groups to drop into posts.
  - name: Webhooks
    description: Signed webhook endpoints that get your notification events.
  - name: Billing
    description: >-
      The owner's plan, invoices and the links that pay for, change or cancel
      it.
  - name: Team
    description: A workspace's teammates and invitations, and their roles.
  - name: Notifications
    description: >-
      Your bell and notification settings, and the workspace's Slack, Discord
      and Telegram channels.
  - name: Blog-to-social
    description: Blog feeds that turn a workspace's new articles into posts.
  - name: Products
    description: Products the workspace's posts can promote.
  - name: Contacts
    description: People who commented on the workspace's posts, and the lists they are on.
  - name: Profile
    description: 'The key''s user: their name and sign-in email.'
  - name: API keys
    description: 'Your API keys: listing and deleting them.'
  - name: Agent sign-up
    description: >-
      An AI agent signs a person up with a code emailed to them, and gets their
      first key. No key needed.
paths:
  /notification-destinations:
    post:
      tags:
        - Notifications
      summary: Add a Slack channel
      description: >-
        Needs `notifications:create`. Your role must let you manage
        notifications (owners and managers). Sends the workspace's notifications
        to a channel of a connected Slack workspace, with the events it gets.
        Discord and Telegram channels come from Create a connect link; webhook
        endpoints are made under [Webhooks](/api-reference/webhooks/create).
      operationId: createNotificationDestination
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workspace_id
                - kind
                - installation_id
                - channel_id
                - events
              properties:
                workspace_id:
                  type: integer
                  description: The workspace. It must be one the key can reach.
                kind:
                  type: string
                  enum:
                    - slack
                installation_id:
                  type: integer
                  description: The connected Slack workspace, from `slack_installations`.
                channel_id:
                  type: string
                  description: A channel id from List Slack channels.
                events:
                  type: array
                  minItems: 1
                  items:
                    type: string
                  description: 'The events it gets: any of `team_chat_events`.'
                name:
                  type: string
                  maxLength: 100
                  description: Defaults to `#` and the channel name.
                approve_buttons:
                  type: boolean
                  description: >-
                    Approve and Reject buttons on approval requests; on unless
                    false.
                account_ids:
                  type: array
                  nullable: true
                  items:
                    type: integer
                  description: Only events about these accounts.
                workspace_ids:
                  type: array
                  nullable: true
                  items:
                    oneOf:
                      - type: integer
                      - type: string
                        enum:
                          - '*'
                  description: >-
                    Other workspaces whose events it also gets, or `["*"]` for
                    every workspace you own.
            examples:
              default:
                summary: 'Failed posts and approvals to #launches'
                value:
                  workspace_id: 12
                  kind: slack
                  installation_id: 7
                  channel_id: C07LAUNCH
                  events:
                    - post.failed
                    - approval.requested
      responses:
        '201':
          description: The new destination.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotificationDestination'
              examples:
                default:
                  summary: '#launches'
                  value:
                    id: 51
                    workspace_id: 12
                    kind: slack
                    name: '#launches'
                    channel:
                      id: C07LAUNCH
                      name: launches
                      is_private: false
                    team_name: Halden Coffee
                    approve_buttons: true
                    events:
                      - post.failed
                      - approval.requested
                    account_ids: null
                    workspace_ids: null
                    active: true
                    failing_since: null
                    disabled_reason: null
                    created_at: '2030-03-15T09:00:00+00:00'
                    updated_at: '2030-03-15T09:00:00+00:00'
                    stats_7d:
                      sent: 0
                      failed: 0
                      daily:
                        - date: '2030-03-09'
                          sent: 0
                          failed: 0
                        - date: '2030-03-10'
                          sent: 0
                          failed: 0
                        - date: '2030-03-11'
                          sent: 0
                          failed: 0
                        - date: '2030-03-12'
                          sent: 0
                          failed: 0
                        - date: '2030-03-13'
                          sent: 0
                          failed: 0
                        - date: '2030-03-14'
                          sent: 0
                          failed: 0
                        - date: '2030-03-15'
                          sent: 0
                          failed: 0
                    last_delivery_at: null
        '401':
          $ref: '#/components/responses/Unauthorized401'
        '403':
          description: >-
            The key lacks `notifications:create`, or its user is inactive, or
            your role can't manage notifications in the workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missing_permission:
                  summary: The key lacks notifications:create
                  value:
                    message: >-
                      This API key does not have the "notifications:create"
                      permission. Edit the key in PostSyncer under Settings →
                      API to grant it.
                role:
                  summary: The role can't manage notifications
                  value:
                    message: >-
                      Your role in the workspace "Halden Coffee" does not allow
                      you to edit notifications. Ask the workspace owner or a
                      manager to do it, or to change your role.
                inactive_account:
                  summary: The key's user is inactive
                  value:
                    message: Your account is inactive.
        '422':
          description: The request didn't pass validation, and nothing changed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
              examples:
                kind:
                  summary: Discord or Telegram
                  value:
                    message: >-
                      Only Slack channels are added this way. Discord and
                      Telegram channels are added with a connect link.
                    errors:
                      kind:
                        - >-
                          Only Slack channels are added this way. Discord and
                          Telegram channels are added with a connect link.
                webhook:
                  summary: A webhook endpoint
                  value:
                    message: >-
                      This is for Slack, Discord and Telegram. For webhook
                      endpoints, use the webhook tools (the /webhooks routes in
                      the API).
                    errors:
                      kind:
                        - >-
                          This is for Slack, Discord and Telegram. For webhook
                          endpoints, use the webhook tools (the /webhooks routes
                          in the API).
                installation:
                  summary: Slack isn't connected to this workspace
                  value:
                    message: Connect Slack to this workspace first.
                    errors:
                      installation_id:
                        - Connect Slack to this workspace first.
                channel:
                  summary: Slack doesn't know the channel
                  value:
                    message: >-
                      Slack doesn’t know this channel. For a private channel,
                      invite @PostSyncer to it first.
                    errors:
                      channel_id:
                        - >-
                          Slack doesn’t know this channel. For a private
                          channel, invite @PostSyncer to it first.
        '429':
          $ref: '#/components/responses/RateLimited429'
components:
  schemas:
    NotificationDestination:
      type: object
      description: >-
        A Slack, Discord or Telegram channel that gets the workspace's
        notifications. Its connection details are never shown.
      required:
        - id
        - workspace_id
        - kind
        - name
        - approve_buttons
        - events
        - account_ids
        - workspace_ids
        - active
        - failing_since
        - disabled_reason
        - created_at
        - updated_at
      properties:
        id:
          type: integer
        workspace_id:
          type: integer
          description: The workspace it belongs to.
        kind:
          type: string
          enum:
            - slack
            - discord
            - telegram
        name:
          type: string
          maxLength: 100
        channel:
          type: object
          description: 'Slack only: the channel.'
          required:
            - id
            - name
            - is_private
          properties:
            id:
              type: string
            name:
              type: string
              nullable: true
            is_private:
              type: boolean
        chat:
          type: object
          description: 'Telegram only: the chat.'
          required:
            - id
            - title
            - type
          properties:
            id:
              type: string
            title:
              type: string
              nullable: true
            type:
              type: string
              nullable: true
              description: '`private`, `group`, `supergroup` or `channel`.'
        team_name:
          type: string
          nullable: true
          description: 'Slack only: the Slack workspace.'
        approve_buttons:
          type: boolean
          description: Whether approval requests carry Approve and Reject buttons.
        events:
          type: array
          items:
            type: string
          description: 'The events it gets: any of `team_chat_events`.'
        account_ids:
          type: array
          nullable: true
          items:
            type: integer
          description: Only events about these accounts; null for every account.
        workspace_ids:
          type: array
          nullable: true
          items:
            oneOf:
              - type: integer
              - type: string
                enum:
                  - '*'
          description: >-
            The other workspaces it gets events from, or `["*"]` for every
            workspace the owner has; null for its own workspace alone.
        active:
          type: boolean
          description: 'False when it is paused: nothing is sent to it.'
        failing_since:
          type: string
          format: date-time
          nullable: true
          description: When its deliveries started failing; null while they work.
        disabled_reason:
          type: string
          nullable: true
          description: Why PostSyncer turned it off; null otherwise.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        stats_7d:
          type: object
          description: >-
            Deliveries over the last 7 days: today and the six days before,
            oldest first.
          required:
            - sent
            - failed
            - daily
          properties:
            sent:
              type: integer
            failed:
              type: integer
            daily:
              type: array
              items:
                type: object
                required:
                  - date
                  - sent
                  - failed
                properties:
                  date:
                    type: string
                    format: date
                  sent:
                    type: integer
                  failed:
                    type: integer
        last_delivery_at:
          type: string
          format: date-time
          nullable: true
          description: When the latest delivery was made; null before the first.
    Error:
      type: object
      description: >-
        An error answer. Every one has `message`, in plain words; some add an
        `error` code and fields of their own.
      required:
        - message
      properties:
        message:
          type: string
          description: What went wrong and what to do about it.
        error:
          type: string
          description: >-
            A code a few errors add, such as `rate_limited`. See [Handle
            errors](/essentials/error-handling#answers-with-an-error-code).
    ValidationError:
      type: object
      description: '422: the request didn''t pass validation, and nothing changed.'
      required:
        - message
        - errors
      properties:
        message:
          type: string
          description: >-
            The first error and, when there are more, how many: `(and 1 more
            error)`, `(and 2 more errors)`.
        errors:
          type: object
          description: >-
            The messages, by field. A field inside a list is named with dots:
            `accounts.0.id`.
          additionalProperties:
            type: array
            items:
              type: string
  responses:
    Unauthorized401:
      description: No API key, or not a valid one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthenticated:
              summary: No valid API key
              value:
                message: Unauthenticated.
    RateLimited429:
      description: >-
        More than 60 requests in a minute from this key's user (the API and the
        MCP server share the count). Wait `Retry-After` seconds.
      headers:
        Retry-After:
          description: Seconds until requests are allowed again.
          schema:
            type: integer
        X-RateLimit-Limit:
          description: Requests allowed a minute.
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: Requests left this minute.
          schema:
            type: integer
        X-RateLimit-Reset:
          description: When requests are allowed again, as a Unix timestamp.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            too_many_attempts:
              summary: Too many requests
              value:
                message: Too Many Attempts.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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