Skip to main content
Use this example to send Vast.ai notification webhooks into a Google Chat space. Vast.ai sends a standard notification payload, and the adapter below verifies the Vast.ai signature before converting it into the {"text": "..."} format Google Chat expects. The flow is:

Prerequisites

  • A Vast.ai API key from Keys
  • A Google Chat space where you can add an incoming webhook
  • Python 3.10 or newer
  • A public HTTPS URL that forwards to your local machine for testing, such as Tunnelmole, ngrok, or Cloudflare Tunnel

Review Notification Settings

Open Account Settings and review Notification Settings. The notification groups shown here are the same event groups you can subscribe to through the API.
Notification Settings page with Account, Billing, and Instance notification groups

Notification Settings

Create a Google Chat Incoming Webhook

In Google Chat:
  1. Create or open a space.
  2. Open the space menu.
  3. Select Apps & integrations.
  4. Add an incoming webhook.
  5. Copy the Google Chat webhook URL.
Keep that URL private. It lets anyone who has it post into the space.

Create the Adapter

Create a working directory and install the only Python dependency:
Create vast_google_chat_adapter.py:

Create the Vast.ai Webhook

From here you use three terminals, all in the vast-google-chat-notifications directory: the adapter terminal you just used, a control terminal for Vast.ai API calls, and a tunnel terminal for tmole. Create the webhook first. The adapter needs this webhook’s signing secret before it can start, and tmole only starts once the adapter is already listening — so you create the webhook with a temporary URL now and point it at the tunnel once the tunnel is up. In the control terminal, set your Vast.ai API key and create the webhook:
The response includes the webhook ID and signing secret. Export the ID for the later API calls:
The signing secret (webhook_secret) is saved in vast-webhook.json. Store it securely — Vast.ai returns it only when the webhook is created or its secret is rotated, not on list or update responses.
You can create the same webhook from the console, but the API flow is best for this example because the adapter needs the signing secret.
Create webhook modal with webhook name and webhook URL fields

Create webhook

Start the Adapter

In the adapter terminal (where the virtual environment is active), load the signing secret from vast-webhook.json, set your Google Chat webhook URL, and start the adapter:
The adapter prints listening on http://127.0.0.1:8787 and listens only on 127.0.0.1. Leave it running; the HTTPS tunnel you start next forwards public Vast.ai deliveries to that local port.

Expose the Adapter Over HTTPS

Vast.ai requires an HTTPS webhook URL. This example uses tmole; if you use another tunnel, run the equivalent command and copy the HTTPS URL it prints. Because tmole only starts once something is listening on the port, start it now that the adapter is running. In the tunnel terminal:
Copy the HTTPS URL it prints, such as https://xxxxxx.tunnelmole.net.

Point the Webhook at Your Tunnel

In the control terminal, set the tunnel URL and update the webhook so Vast.ai delivers to it:

Send a Test Delivery

In the control terminal, send Vast.ai’s built-in test event:
The adapter should print a forwarded event, and the Google Chat space should receive a Vast.ai webhook test message.

Trigger a Real Notification

After the test event works, trigger one of the subscribed events:
  • Create an instance to receive client:instance_created.
  • Start an instance to receive client:instance_started.
  • Stop an instance to receive client:instance_stopped.
  • Keep low-balance notifications enabled to receive client:low_credit when your configured threshold is reached.
You can list available notification types at any time:

Clean Up

In the control terminal, delete the webhook when you are done testing:
Then stop the adapter and the HTTPS tunnel.

Production Notes

  • Deploy the adapter on a stable HTTPS endpoint before using it for production alerts.
  • Verify X-Vast-Signature-256 before forwarding or acting on any event.
  • Deduplicate deliveries by event_id; webhook delivery is at-least-once.
  • Return 2xx only after your adapter accepts the event.
  • Do not register the Google Chat incoming webhook URL directly in Vast.ai. Google Chat expects its own message format, so it needs an adapter between Vast.ai and Google Chat.