> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.lumenia.net/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.lumenia.net/_mcp/server.

# Connect workspace Telegram integration

PUT https://app.lumenia.net/api/v1/workspaces/{workspaceId}/integrations/telegram
Content-Type: application/json

Connect or replace a workspace Telegram integration.

Reference: https://docs.lumenia.net/api-reference/workspace-telegram/connect-workspace-telegram-integration

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <API_KEY>`, where `API_KEY` is your API key.

## Request

### Path parameters

- `workspaceId` (string, required) — Workspace whose Telegram integration to configure.

### Headers

- `X-Account-Id` (string, required) — Account that owns the workspace.

### Body (application/json)

This endpoint expects an object.

- `botToken` (string, required) — Telegram bot token from BotFather. It is validated when connecting and is never returned.

## Response

### 200

The connected Telegram integration.

- `telegram` (V1WorkspacesWorkspaceIdIntegrationsTelegramPutResponsesContentApplicationJsonSchemaTelegram, required) — Telegram integration status. Sensitive credentials are not returned.

## Errors

### 400 Bad Request Error

Missing/invalid botToken, or the bot token was rejected by Telegram

- `any`

### 403 Forbidden Error

The API key is missing or invalid, or the X-Account-Id does not belong to the partner.

- `message` (string, optional)

### 404 Not Found Error

Workspace not found for this account

- `any`

### 500 Internal Server Error

Internal Server Error

- `any`

### 502 Bad Gateway Error

Telegram rejected the webhook setup

- `any`

### 503 Service Unavailable Error

The public application URL is not configured

- `any`

## Types

### V1WorkspacesWorkspaceIdIntegrationsTelegramPutResponsesContentApplicationJsonSchemaTelegram

Telegram integration status. Sensitive credentials are not returned.

- `connected` (boolean, optional) — Whether Telegram is connected on this workspace.
- `botUsername` (string, optional, nullable) — Public bot username.
- `botUserId` (string, optional, nullable) — Telegram bot user id.
- `botUrl` (string, optional, nullable) — Public t.me deep link to the bot; null when the username is unknown.

## Examples

**Request**

```json
{
  "botToken": "123456789:AAExampleBotTokenFromBotFather"
}
```

**Response**

```json
{
  "telegram": {
    "connected": true,
    "botUsername": "acme_support_bot",
    "botUserId": "8012345678",
    "botUrl": "https://t.me/acme_support_bot"
  }
}
```

**SDK Code**

```python
import requests

url = "https://app.lumenia.net/api/v1/workspaces/workspaceId/integrations/telegram"

payload = { "botToken": "123456789:AAExampleBotTokenFromBotFather" }
headers = {
    "X-Account-Id": "X-Account-Id",
    "Authorization": "Bearer <API_KEY>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.lumenia.net/api/v1/workspaces/workspaceId/integrations/telegram';
const options = {
  method: 'PUT',
  headers: {
    'X-Account-Id': 'X-Account-Id',
    Authorization: 'Bearer <API_KEY>',
    'Content-Type': 'application/json'
  },
  body: '{"botToken":"123456789:AAExampleBotTokenFromBotFather"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.lumenia.net/api/v1/workspaces/workspaceId/integrations/telegram"

	payload := strings.NewReader("{\n  \"botToken\": \"123456789:AAExampleBotTokenFromBotFather\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("X-Account-Id", "X-Account-Id")
	req.Header.Add("Authorization", "Bearer <API_KEY>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.lumenia.net/api/v1/workspaces/workspaceId/integrations/telegram")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["X-Account-Id"] = 'X-Account-Id'
request["Authorization"] = 'Bearer <API_KEY>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"botToken\": \"123456789:AAExampleBotTokenFromBotFather\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://app.lumenia.net/api/v1/workspaces/workspaceId/integrations/telegram")
  .header("X-Account-Id", "X-Account-Id")
  .header("Authorization", "Bearer <API_KEY>")
  .header("Content-Type", "application/json")
  .body("{\n  \"botToken\": \"123456789:AAExampleBotTokenFromBotFather\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://app.lumenia.net/api/v1/workspaces/workspaceId/integrations/telegram', [
  'body' => '{
  "botToken": "123456789:AAExampleBotTokenFromBotFather"
}',
  'headers' => [
    'Authorization' => 'Bearer <API_KEY>',
    'Content-Type' => 'application/json',
    'X-Account-Id' => 'X-Account-Id',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.lumenia.net/api/v1/workspaces/workspaceId/integrations/telegram");
var request = new RestRequest(Method.PUT);
request.AddHeader("X-Account-Id", "X-Account-Id");
request.AddHeader("Authorization", "Bearer <API_KEY>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"botToken\": \"123456789:AAExampleBotTokenFromBotFather\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Account-Id": "X-Account-Id",
  "Authorization": "Bearer <API_KEY>",
  "Content-Type": "application/json"
]
let parameters = ["botToken": "123456789:AAExampleBotTokenFromBotFather"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.lumenia.net/api/v1/workspaces/workspaceId/integrations/telegram")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```