API reference

Telegram

3 endpoints, served at https://orbitwrite.com/api/v1. Each one lists the credentials it accepts, its parameters and every response it can give.

The Telegram bot to add to a channel#

GET/api/v1/integrations/telegram/bot

The bot a channel must have as an administrator (with Post Messages) before POST /integrations/telegram/channels can connect it, plus deep links that add it.

Authentication

An API key or OAuth access token as a bearer token, or a signed-in session.

Responses

200object

The bot

Response attributes
botTelegramBotRequired
Child attributes
usernamestringRequired

The bot's @name, without the @.

addToChannelUrlstringRequired

Opens Telegram's picker to add the bot to a channel as an administrator, with Post Messages pre-selected.

addToGroupUrlstringRequired

Opens Telegram's picker to add the bot to a group.

401Error

Not signed in

Response attributes
errorstringRequired
issuesany[]
429Error

Rate limit exceeded

Response attributes
errorstringRequired
issuesany[]
502Error

Telegram API unreachable, or no bot is configured

Response attributes
errorstringRequired
issuesany[]
GET /api/v1/integrations/telegram/bot
curl -X GET "https://orbitwrite.com/api/v1/integrations/telegram/bot" \
  -H "Authorization: Bearer $ORBITWRITE_API_KEY"
Response
{
  "bot": {
    "username": "OrbitwriteBot",
    "addToChannelUrl": "string",
    "addToGroupUrl": "string"
  }
}

Get the code that proves you control a Telegram channel#

POST/api/v1/integrations/telegram/channels/verification

Checks a Telegram channel is connectable — it exists, the bot is in it and can post — and returns the verification code its description must carry before POST /integrations/telegram/channels will connect it. Refuses exactly what the connect would, with the same messages. Requires account:connect.

Authentication

An API key or OAuth access token as a bearer token, or a signed-in session.

Query parameters

organizationIdstring

Session callers only — an API key already determines the workspace.

At least 1 character.

Body application/json

chatstringRequired

The channel to connect: @username, a t.me/username link, or the numeric chat id for a private channel. The bot must already be an administrator of the channel with the Post Messages right, and the channel's description must carry this workspace's verification code — the first attempt without it is refused with the code to add.

Between 1 and 256 characters.

Responses

200object

The channel is connectable; here is its code

Response attributes
verificationTelegramChannelVerificationRequired
Child attributes
chatobjectRequired
Child attributes
titlestringRequired
displayHandlestringRequired
typestringRequired
  • "group"
  • "supergroup"
  • "channel"
verificationCodestringRequired

Add this to the channel's description, then call POST /integrations/telegram/channels. It can be removed once the channel is connected.

verifiedbooleanRequired

Whether the description already carries the code.

400Error

Invalid request

Response attributes
errorstringRequired
issuesany[]
401Error

Not signed in

Response attributes
errorstringRequired
issuesany[]
403Error

Not a member of the organization

Response attributes
errorstringRequired
issuesany[]
404Error

The resource does not exist

Response attributes
errorstringRequired
issuesany[]
429Error

Rate limit exceeded

Response attributes
errorstringRequired
issuesany[]
502Error

Telegram API unreachable while checking the channel

Response attributes
errorstringRequired
issuesany[]
POST /api/v1/integrations/telegram/channels/verification
curl -X POST "https://orbitwrite.com/api/v1/integrations/telegram/channels/verification" \
  -H "Authorization: Bearer $ORBITWRITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "chat": "string"
}'
Response
{
  "verification": {
    "chat": {
      "title": "string",
      "displayHandle": "string",
      "type": "group"
    },
    "verificationCode": "orbitwrite-verify-0123456789abcdef0123",
    "verified": true
  }
}

Connect a Telegram channel as a posting channel#

POST/api/v1/integrations/telegram/channels

Adds a Telegram channel or group to the workspace's channels, so posts can be published to it. Telegram has no OAuth flow: a person adds the bot (see GET /integrations/telegram/bot) to the channel as an administrator in Telegram itself, and this call names it. The bot's presence and its Post Messages right are both verified, and the channel's description must carry this workspace's verification code — the bot is shared by every workspace, so its presence proves nothing about who controls the channel. The first attempt without the code is refused with a 400 whose message carries the code to add. Requires account:connect.

Authentication

An API key or OAuth access token as a bearer token, or a signed-in session.

Query parameters

organizationIdstring

Session callers only — an API key already determines the workspace.

At least 1 character.

Body application/json

chatstringRequired

The channel to connect: @username, a t.me/username link, or the numeric chat id for a private channel. The bot must already be an administrator of the channel with the Post Messages right, and the channel's description must carry this workspace's verification code — the first attempt without it is refused with the code to add.

Between 1 and 256 characters.

Responses

200ConnectTelegramChannelResult

The channel is connected

Response attributes
channelConnectedTelegramChannelRequired
Child attributes
idstringRequired
displayHandlestringRequired
createdbooleanRequired
restoredbooleanRequired
becamePrimarybooleanRequired
400Error

Invalid request

Response attributes
errorstringRequired
issuesany[]
401Error

Not signed in

Response attributes
errorstringRequired
issuesany[]
403Error

Not a member of the organization

Response attributes
errorstringRequired
issuesany[]
404Error

The resource does not exist

Response attributes
errorstringRequired
issuesany[]
429Error

Rate limit exceeded

Response attributes
errorstringRequired
issuesany[]
502Error

Telegram API unreachable while verifying the channel

Response attributes
errorstringRequired
issuesany[]
POST /api/v1/integrations/telegram/channels
curl -X POST "https://orbitwrite.com/api/v1/integrations/telegram/channels" \
  -H "Authorization: Bearer $ORBITWRITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "chat": "string"
}'
Response
{
  "channel": {
    "id": "string",
    "displayHandle": "string",
    "created": true,
    "restored": true,
    "becamePrimary": true
  }
}