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

# Create a connect link

> A link to connect Slack, Discord or Telegram to a workspace.

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

Give `url` to the person. What happens when they open it depends on `kind`:

* **Slack:** they allow PostSyncer in their Slack workspace. Then pick a channel with [List Slack channels](https://docs.postsyncer.com/api-reference/notifications/slack-channels.md) and add it with [Add a Slack channel](https://docs.postsyncer.com/api-reference/notifications/create-destination.md).
* **Discord:** they pick a server and a channel, and that channel is added with the team's default events.
* **Telegram:** the bot's start link, the same one the app makes. `chat_type` is `group` (they add the bot to a group) or `private` (a chat with the bot). Optional `events` and `account_ids` set what the chat gets.

Slack's and Discord's links finish with no PostSyncer login. Each works once, for 30 minutes, and only for this workspace and the key's user, while their role still lets them manage notifications. The page they land on says what happened and sends them back to you. A Telegram link lasts 15 minutes.

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`, `discord` or `telegram`, Telegram without `chat_type`, or the app isn't set up on this server. | No. |
| 429 | More than 60 requests a minute. | Yes, after `Retry-After` seconds. |


## OpenAPI

````yaml POST /notification-settings/connect-links
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-settings/connect-links:
    post:
      tags:
        - Notifications
      summary: Create a connect link
      description: >-
        Needs `notifications:create`. Your role must let you manage
        notifications (owners and managers). A link the person opens to connect
        Slack, Discord or Telegram to the workspace. Slack's and Discord's links
        finish on their own, with no PostSyncer login: they work once, for 30
        minutes, for this workspace and the key's user. After Slack, pick a
        channel with List Slack channels and add it with Add a Slack channel;
        Discord adds the channel picked on its page. Telegram's link is the
        bot's start link the app makes (`chat_type` `group` or `private`,
        optional `events`), for 15 minutes. Webhook endpoints are made under
        [Webhooks](/api-reference/webhooks/create).
      operationId: createNotificationConnectLink
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workspace_id
                - kind
              properties:
                workspace_id:
                  type: integer
                  description: The workspace. It must be one the key can reach.
                kind:
                  type: string
                  enum:
                    - slack
                    - discord
                    - telegram
                chat_type:
                  type: string
                  enum:
                    - group
                    - private
                  description: >-
                    Telegram only, and needed there: a group, or a private chat
                    with the bot.
                events:
                  type: array
                  minItems: 1
                  items:
                    type: string
                  description: >-
                    Telegram only: the events the chat gets; the defaults when
                    left out.
                account_ids:
                  type: array
                  nullable: true
                  items:
                    type: integer
                  description: 'Telegram only: only events about these accounts.'
            examples:
              default:
                summary: Connect Slack
                value:
                  workspace_id: 12
                  kind: slack
              discord:
                summary: Connect Discord
                value:
                  workspace_id: 12
                  kind: discord
              telegram:
                summary: Connect a Telegram group
                value:
                  workspace_id: 12
                  kind: telegram
                  chat_type: group
                  events:
                    - post.failed
                    - approval.requested
      responses:
        '201':
          description: The link.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotificationConnectLink'
              examples:
                default:
                  summary: Slack
                  value:
                    url: >-
                      https://slack.com/oauth/v2/authorize?client_id=4411.7788&scope=chat%3Awrite%2Cchannels%3Aread&redirect_uri=https%3A%2F%2Fpostsyncer.com%2Fapi%2Fintegrations%2Fslack%2Fcallback&state=nclink_8fJ2kQ
                    kind: slack
                    workspace_id: 12
                    expires_at: '2030-03-15T09:30:00+00:00'
                telegram:
                  summary: Telegram
                  value:
                    url: >-
                      https://t.me/PostSyncerAlertsBot?startgroup=Qm3xT8vLp2RsW9yZc4Hn6JdK1aFe7GbU&admin=delete_messages
                    kind: telegram
                    workspace_id: 12
                    expires_at: '2030-03-15T09:15:00+00:00'
        '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, or the app isn't set up on this server.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ValidationError'
                  - $ref: '#/components/schemas/Error'
              examples:
                not_set_up:
                  summary: Slack isn't set up on this server
                  value:
                    message: Slack isn’t set up on this server yet.
                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).
                chat_type:
                  summary: Telegram without chat_type
                  value:
                    message: The chat type field is required.
                    errors:
                      chat_type:
                        - The chat type field is required.
                invalid_workspace:
                  summary: The workspace isn't one the key can reach
                  value:
                    message: Invalid workspace ID.
                    errors:
                      workspace_id:
                        - Invalid workspace ID.
        '429':
          $ref: '#/components/responses/RateLimited429'
components:
  schemas:
    NotificationConnectLink:
      type: object
      description: A link the person opens to connect Slack, Discord or Telegram.
      required:
        - url
        - kind
        - workspace_id
        - expires_at
      properties:
        url:
          type: string
          description: >-
            Slack's or Discord's page to allow PostSyncer, or the Telegram bot's
            start link.
        kind:
          type: string
          enum:
            - slack
            - discord
            - telegram
        workspace_id:
          type: integer
        expires_at:
          type: string
          format: date-time
          description: >-
            The link works until then: 30 minutes for Slack and Discord, 15 for
            Telegram.
    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.