Creating Robots
Robots are created and managed through the robot management portal at /robots. Only server owners can create robots for their servers.
Step 1: Access the Portal
Navigate to trylag.com/robots and sign in. You will see a list of servers you own. Select the server where you want to create a robot.
Step 2: Create a New Robot
Click Create Robot to begin the creation flow. You will need to provide:
Name
Choose a display name for your robot. Names must be:
- Between 1 and 32 characters
- Unique within the server (no two robots can share a name)
The name appears alongside robot messages in chat, so choose something descriptive like “Moderation Bot” or “CI Notifications”.
Transport Type
Select how your robot will receive events from Lag. There are three options:
- Webhook - Lag sends HTTP POST requests to your URL when events occur
- SSE - Your application connects to Lag and receives a real-time event stream
- Long-poll - Your application periodically requests pending events
See Transport Types for detailed comparisons.
If you choose Webhook, you must also provide a Webhook URL - the HTTPS endpoint where Lag will send event payloads.
Permissions
Select which permissions your robot needs:
- Read Messages - Receive message content from rooms
- Send Messages - Post messages to rooms
- Read Members - Access the server member list
- Read Voice - Receive voice join/leave events
- Read Rooms - Access room list and room events
- Read Presence - Receive member online/offline status changes
Grant only the permissions your robot actually needs. Permissions can be updated later.
Event Subscriptions
Choose which events your robot should receive. Only subscribed events are delivered through your chosen transport. Available events include:
room.message- A message was sent in a roomroom.message.edited- A message was editedroom.message.deleted- A message was deletedvoice.join- A user joined a voice roomvoice.leave- A user left a voice roommember.join- A new member joined the servermember.leave- A member left the server- And more - see Events & Permissions for the full list
Step 3: Save and Get Your API Key
After creating the robot, you will be shown the API key. This key is displayed only once and cannot be retrieved later. Copy it immediately and store it securely.
The API key format is:
lag_robot_<prefix>_<secret> If you lose your API key, you can regenerate it from the robot’s settings page. Regenerating invalidates the previous key immediately.
Step 4: Configure Webhook Secret (Webhook Transport Only)
If you selected webhook transport, a webhook signing secret is generated automatically. This secret is used to verify that incoming webhook requests are genuinely from Lag. The secret format is:
whsec_<base64-encoded-secret> Store this secret alongside your API key. See Transport Types for signature verification details.
Managing Robots
After creation, you can manage your robots from the portal:
- Edit - Update name, permissions, event subscriptions, or webhook URL
- View logs - See recent event delivery history and errors
- Regenerate API key - Issue a new key (invalidates the old one)
- Regenerate webhook secret - Issue a new signing secret
- Delete - Permanently remove the robot and all its data
Troubleshooting
Robot not receiving events
- Verify the robot has the correct event subscriptions enabled
- Check that the robot has the required permissions for those events
- For webhooks, ensure your URL is reachable and responds with a 2xx status
- Check the robot’s delivery logs for error details
Authentication failures
- Confirm the API key is correct and has not been regenerated
- Ensure the
Authorizationheader format isRobot lag_robot_<prefix>_<secret> - Verify the robot has not been deleted