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

# Connect Telegram Bot

> Connect Telegram Bot.



## OpenAPI

````yaml PUT /ai/social/telegram/connect
openapi: 3.1.0
info:
  title: Blog API
  version: 1.0.0
servers:
  - url: https://api.octaviatech.app/cms
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Tags
    description: Tag management endpoints
paths:
  /ai/social/telegram/connect:
    put:
      tags:
        - AI
      summary: Connect or replace the tenant's Telegram bot
      description: >-
        Upserts the Telegram connection. The bot token is encrypted at rest and
        masked in the response. Re-calling this endpoint replaces the stored
        credentials and marks the connection active.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - botToken
                - chatId
              properties:
                botToken:
                  type: string
                  minLength: 20
                  description: Telegram bot token
                chatId:
                  type: string
                  minLength: 2
                  description: Target chat id the bot posts to
                  example: '-1001234567890'
            examples:
              Basic:
                value:
                  botToken: 123456789:AAF-abcdefghijklmnopqrstuvwxyz012345
                  chatId: '-1001234567890'
      responses:
        '200':
          description: OK (connected)
          content:
            application/json:
              example:
                success: true
                statusCode: 200
                message: Telegram connected
                data:
                  tenantId: '{{objectId}}'
                  provider: telegram
                  isActive: true
                  config:
                    botToken: 1234...6789
                    chatId: '-1001234567890'
                  updatedBy: '{{objectId}}'
                  updatedAt: '2025-10-01T12:00:00.000Z'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden (role not allowed)
        '406':
          description: Validation failed
        '500':
          description: Failed to store the connection
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````