Volt API documentation

Build bots or connect a messaging client to https://app.volt.im.

Sign in

Sign in with an existing Volt account to get a session token.

curl https://app.volt.im/api/auth \
  --json '{"username":"YOUR_USERNAME","password":"YOUR_PASSWORD"}'

Use the returned token as VOLT_SESSION in requests that use the __Host-volt-token session cookie.

Bot API

Users type @examplebot hello in the web composer. Your bot receives the search query and returns results for the user to choose and send. The update contains the sender’s identity, query, and pagination offset.

The /bot/ endpoints use Authorization: Bearer <bot token>. Their JSON responses contain ok and result on success, or ok, error_code, and description on failure.

Register a bot

Choose a unique username of 5–32 characters ending in bot. Letters, digits, underscores, and hyphens are allowed.

curl https://app.volt.im/api/bots \
  --cookie "__Host-volt-token=$VOLT_SESSION" \
  --json '{"username":"examplebot","first_name":"Example"}'

The response contains a bot object and a token. Use the returned token as VOLT_BOT_TOKEN in the following examples.

Get bot identity

curl https://app.volt.im/bot/getMe \
  --header "Authorization: Bearer $VOLT_BOT_TOKEN"

The result includes id, username, first_name, is_bot, and supports_inline_queries.

Poll for updates

curl https://app.volt.im/bot/getUpdates \
  --header "Authorization: Bearer $VOLT_BOT_TOKEN" \
  --json '{"offset":0,"limit":20}'

Each entry in result contains an update_id and one of message, callback_query, and inline_query. All three use the same offset. The limit accepts 1–100. Poll about once per second when idle. For the next call, use the highest processed update_id plus one as the offset to acknowledge those updates.

Answer a query

An inline_query contains id, from, query, and offset. Use its id as inline_query_id. The example uses "123" as a placeholder.

curl https://app.volt.im/bot/answerInlineQuery \
  --header "Authorization: Bearer $VOLT_BOT_TOKEN" \
  --json '{
    "inline_query_id": "123",
    "results": [{
      "type": "article",
      "id": "hello",
      "title": "Say hello",
      "input_message_content": {"message_text": "Hello from Volt"}
    }],
    "next_offset": ""
  }'

Return up to 50 results with unique IDs. An optional HTTPS thumbnail_url previews a result.

article
Set title and input_message_content.message_text.
gif
Set gif_url to a direct HTTPS GIF URL.
video
Set title and an HTTPS video_url.

For media, input_message_content.message_text can override the sent link. Set next_offset to offer another page. Queries expire after two minutes. A successful answer returns {"ok":true,"result":true} and can be retried with the same payload.

Rotate a token

The bot owner can issue a new token using their Volt session. The old token expires immediately.

curl https://app.volt.im/api/bots/examplebot/token \
  --cookie "__Host-volt-token=$VOLT_SESSION" \
  --request POST

Built-in bots

Type @vid search terms to look up YouTube videos or @gif search terms to look up GIFs. Availability depends on whether the Volt instance has the corresponding search provider configured.

Direct bot chats

Share https://app.volt.im/bots/examplebot. When a signed-in user presses Start chat, Volt opens a private conversation and sends /start to the bot. The bot receives text written in that conversation. Deleting the chat closes it to the bot until the user opens it again.

Poll getUpdates for a message with message_id, date, from, chat, and text. Unacknowledged message updates expire after one day. Use message.chat.id as chat_id when replying.

curl https://app.volt.im/bot/sendMessage \
  --header "Authorization: Bearer $VOLT_BOT_TOKEN" \
  --json '{
    "chat_id": 42,
    "text": "Hello from Volt",
    "reply_parameters": {"message_id": 123}
  }'

Replace 42 and 123 with the IDs in your update. The reply is optional. Messages support plain text up to 4096 characters. Supply an optional client_id to retry a send without posting a second copy.

POST /bot/getChat
Pass chat_id to look up an open conversation with your bot.
POST /bot/editMessageText
Pass chat_id, message_id, and the new text to edit a message sent by your bot.
POST /bot/deleteMessage
Pass chat_id and message_id to remove a message sent by your bot.

A signed-in Volt API client can open the same conversation with POST /api/bots/examplebot/chat, then send text through the regular messaging API.

Callback buttons

Pass reply_markup.inline_keyboard to sendMessage to place buttons under a bot message in a direct chat. Each array is a row. A keyboard supports up to eight rows with up to three buttons each. Each button needs a visible text label of up to 60 characters and callback_data of 1–64 UTF-8 bytes.

curl https://app.volt.im/bot/sendMessage \
  --header "Authorization: Bearer $VOLT_BOT_TOKEN" \
  --json '{
    "chat_id": 42,
    "text": "Is this the right time?",
    "reply_markup": {
      "inline_keyboard": [[
        {"text": "Confirm", "callback_data": "confirm"},
        {"text": "Choose another time", "callback_data": "reschedule"}
      ]]
				
}'

When the user presses a button, getUpdates returns a callback_query with id, from, message, chat_instance, and data. Call answerCallbackQuery promptly with that id to finish the interaction. The query expires after two minutes.

curl https://app.volt.im/bot/answerCallbackQuery \
  --header "Authorization: Bearer $VOLT_BOT_TOKEN" \
  --json '{"callback_query_id":"123","text":"Confirmed","show_alert":false}'

Use text for an optional notice of up to 200 characters. Set show_alert to true to present the notice as a dialog. You can also call POST /bot/editMessageReplyMarkup with chat_id, message_id, and a replacement reply_markup. Omit reply_markup or send an empty keyboard to remove the buttons. editMessageText can update the keyboard at the same time.

Messaging API

REST requests on app.volt.im authenticate with the __Host-volt-token session cookie. Live events use wss://app.volt.im/ws/?token=<session token>. The API checks access to the requested conversations.

GET /api/me
Get the signed-in account.
GET /api/servers
List the account’s servers.
GET /api/servers/<server_id>
Get a server by ID.
GET /api/servers/<server_id>/chats
List accessible channels in a server.
GET /api/me/chats
List direct conversations.
GET /api/allchats
Get servers and conversations in one request.
GET /api/chats/<chat_id>/messages
Read recent messages or page with before and after.
POST /api/chats/<chat_id>/messages
Send a JSON body such as {"text":"Hello"}. In an end-to-end encrypted chat, set text to an encrypted envelope.

Read the messaging protocol reference (Markdown)