Documentation/Webhooks

Webhook System

Set up webhooks to receive notifications that will probably arrive when you least expect them.

What are Webhooks?

Like carrier pigeons, but for the internet

Webhooks are a way for our system to notify your system when something happens. It's like setting up a doorbell that rings at your neighbor's house. When an event occurs (someone presses the doorbell), we send an HTTP POST request to your specified URL (your neighbor comes to tell you).

Important Note

Webhooks are perfect for when you want to be woken up at 3 AM because your model finished training with a 98.7% accuracy instead of the expected 98.6%. Critical information, obviously.

Available Webhook Events

Things we'll notify you about, whether you want us to or not

reasoning_complete

Triggered when a model completes a reasoning task. Useful for knowing when your model has finished thinking about something profound, like whether a hotdog is a sandwich.

model_updated

Triggered when a model is updated or a new version is deployed. Perfect for knowing exactly when your carefully tuned prompts stop working.

error

Triggered when something goes wrong. Which, let's be honest, is probably more often than you'd like. At least now you'll know about it immediately instead of when your users start complaining.

twitter_post

Triggered when a model output is posted to Twitter. Great for tracking which of your AI's outputs are going viral for all the wrong reasons.

Webhook Payload Format

The data we'll send to your endpoint, in all its JSON glory

{
  "event_type": "reasoning_complete",
  "timestamp": "2023-06-15T14:22:33Z",
  "data": {
    "request_id": "req-a1b2c3d4e5f6",
    "input": "What is the relationship between temperature and pressure?",
    "context": "thermodynamics, ideal gas law",
    "reasoning": "According to the ideal gas law (PV=nRT), temperature and pressure are directly proportional...",
    "confidence": 0.92,
    "processing_time_ms": 1250,
    "token_count": 156,
    "model_version": "llama-2-7b-reasoning-v1.0"
  }
}

All webhook payloads include the event type, a timestamp, and a data object containing the relevant information for that event. The exact structure of the data object varies depending on the event type, but we've tried to keep it as consistent as possible. Which means it's consistently inconsistent.

Twitter Integration

Automatically share your model's wisdom with the world

Twitter Webhook Integration

Our Twitter integration allows you to automatically post model outputs to Twitter. Perfect for when you want to share your AI's deep thoughts without the hassle of copying and pasting. Or for when you want to completely automate your social media presence and let the AI do all the talking. What could go wrong?

Setup Required

To use the Twitter integration, you'll need to connect your Twitter account via OAuth. We store your OAuth tokens securely in our database, ready to post tweets on your behalf at the most inopportune moments.

How to Configure Twitter Webhooks

  1. 1

    Go to the Admin Dashboard and navigate to the Webhooks tab.

  2. 2

    Click "Add New Webhook" and select "Twitter" from the integration dropdown.

  3. 3

    Click "Connect Twitter Account" and follow the OAuth flow to authorize our app.

  4. 4

    Configure your tweet template and which events should trigger tweets.

  5. 5

    Save your configuration and watch as your AI takes over your Twitter presence.

Best Practices

Tips for webhook success, or at least minimizing webhook failure

  • Implement proper error handling in your webhook receiver. We'll keep trying to send the webhook until we get a 2xx response, or until the heat death of the universe, whichever comes first.
  • Respond quickly to webhook requests. If your endpoint takes too long to respond, we might time out and consider it a failure. Then we'll retry, creating a never-ending cycle of webhook attempts.
  • Verify webhook signatures to ensure the requests are actually coming from us and not some random internet denizen trying to mess with your system.
  • Set up monitoring for your webhook receiver. If it goes down, you'll miss all those important notifications about your model's deep thoughts on hotdogs.