Connecting the VPN bot
For Admins / Integrations

Connecting the VPN bot

The ForestsNet VPN bot and SupportHub work as a pair: the bot's cabinet gets a support chat that recognizes the customer, and the operator gets a client card with subscriptions, balance and payments right in the ticket. All it takes is one API key.

Step 1. An API key in SupportHub

  1. 1
    Create a key
    Open SettingsAPI keys and click Create key. Any name will do, for example “VPN bot”. The key is shown only once, so copy it right away.

SupportHub tells the project by the key. If the bot asks for a Workspace ID, it's the project ID: the Project ID (Workspace ID) line under the title of the main Settings page, with a Copy button next to it (more).

Step 2. Connecting in the bot

  1. 1
    Turn the integration on
    In the bot's web admin, in the SupportHub settings, turn on “Включить SupportHub” (Enable SupportHub). It's off by default, and while it's off the bot doesn't call SupportHub at all.
  2. 2
    Enter the address and key
    In the “Подключение к SupportHub” block: API base URL https://supporthub.cc/api/v1, the API key from step 1, and the project ID as the Workspace ID. Save.
  3. 3
    Fetch the widget signing secret
    In the “SupportHub — actions” block, click “Получить widget signing secret” (Get widget signing secret). The bot fetches the secret it signs the customer's sign-in to the widget with, and the support chat in the bot's cabinet recognizes the customer.

Step 3. The client card

The operator sees the bot's customer right in the ticket: subscriptions and devices, balance, payments, and the Open in bot and Web admin buttons. The bot can set the card up itself through the SupportHub API (see “For bot developers” below). By hand it takes a minute:

  1. 1
    Apply the preset
    SettingsClient card → Presets → Ready-made VPN client card.
  2. 2
    Enter the bot's address
    In the “VPN service — customer data” source, replace api.example.com with your bot's domain: https://<bot domain>/api/v1/support/users/lookup.
  3. 3
    Paste the bot's key
    Paste the support key from the bot's settings into the X-Support-API-Key header and save. It's stored encrypted.

The card needs bot version 3.5.0 or later. With an older build the card says the bot needs an update to 3.5.0.

Checking

  • In SettingsAPI keys the key shows “Used: …” instead of “Never used”: the bot is calling SupportHub.
  • A ticket from a bot customer shows the card with their subscriptions at the bottom.
  • In the bot's cabinet the support chat writes as the customer, not as a guest.

If it doesn't work

“SupportHub SDK не установлен или интеграция не настроена”

(“SupportHub SDK isn't installed or the integration isn't set up”.) Almost always “Включить SupportHub” is off. Turn it on, save and click the button again, no bot restart is needed. If the switch is on, check the API address and the key.

The bot doesn't reach SupportHub

The key in API keys still says “Never used”. Check that the key was copied whole (it starts with sk_), hasn't been deleted, and the API address is https://supporthub.cc/api/v1.

Do I need to top up

No. The API works with a key on any plan. The exception is the knowledge base methods: until the plan includes the knowledge base, they answer 403 PLAN_FEATURE_UNAVAILABLE.

The card is empty or shows an error

  • “User not found in the bot”: the bot looked the customer up by their ID, Telegram ID or email and didn't find them.
  • “Nothing to look up by”: the customer has no verified ID. SupportHub doesn't send the bot an email or Telegram ID the visitor typed into the widget themselves. The customer is found once they write from Telegram or sign in on the bot's site.
  • “The address doesn't lead to the bot's API”: another server answers at the card's address. It needs the address of the bot's API, not of its webhook server or site.
  • “The bot rejected the API key”: the key was revoked or issued by another bot. Issue a new one in the bot and paste it into the card.
  • “The bot's server refused the request”: the bot's API is closed to SupportHub, for example it lets in only the bridge's address. Open access.
  • “The bot needs an update to 3.5.0”: update the bot.
  • “Integration service unavailable”: the bot didn't answer or answered with an error. Check that it's running and reachable from the internet.

For bot developers

Everything the bot needs from SupportHub comes with one project key. The project ID and name are at GET /api/v1/workspace/settings, the widget signing secret at GET /api/v1/widget/signing-secret. The bot sets the client card up in the project itself: calling again updates the address and key in place, without a second card, and the rest of the project's card stays as it is. GET on the same address says whether it's connected, DELETE removes it. Details are in the API reference.

http
PUT https://supporthub.cc/api/v1/integrations/vpn-bot
Authorization: Bearer sk_...
Content-Type: application/json

{
  "lookup_url": "https://bot.example.com/api/v1/support/users/lookup",
  "api_key": "<bot support key>"
}

→ 200 {"connected": true, "lookup_url": "https://bot.example.com/api/v1/support/users/lookup"}
Was this page helpful?