Integrations3 min read
Sentry
Receive Sentry issue alerts in OpsKnight
Sentry Integration
Receive error and issue alerts from Sentry and create incidents automatically.
Endpoint
POST /api/integrations/sentry?integrationId=YOUR_INTEGRATION_ID
Setup
Step 1: Create Integration in OpsKnight
- Go to Services and select your service
- Click Integrations tab
- Click Add Integration
- Select Sentry
- Copy the Integration ID
- (Optional) Generate a Signing Secret for security
Step 2: Configure Sentry Webhook
- In Sentry, go to Settings → Integrations
- Search for Webhooks
- Click Add to Project or configure existing
- Set Callback URL:
https://YOUR_OPSKNIGHT_URL/api/integrations/sentry?integrationId=YOUR_INTEGRATION_ID
Step 3: Create Alert Rule
- Go to Alerts in Sentry
- Click Create Alert Rule
- Configure conditions (e.g., "When an event is seen")
- Add action: Send a notification via webhooks
- Select your OpsKnight webhook
- Save the rule
Security
Strict Security Enforcement: If you generate a Signing Secret in OpsKnight, you MUST configure the same secret in Sentry. OpsKnight will reject any requests without a valid signature if a secret exists.
Configuring Signing Secret
- In OpsKnight, copy the Signing Secret from the integration
- In Sentry webhook settings, add the secret
- Sentry will include signature in requests
Supported Formats
Issue Format
{
"action": "created",
"issue": {
"id": "12345",
"shortId": "PROJECT-ABC",
"title": "TypeError: Cannot read property 'foo' of undefined",
"culprit": "app/components/Button.tsx",
"level": "error",
"status": "unresolved",
"metadata": {
"type": "TypeError",
"value": "Cannot read property 'foo' of undefined"
},
"permalink": "https://sentry.io/organizations/myorg/issues/12345/"
},
"project": {
"name": "My Project",
"slug": "my-project"
}
}
Legacy Event Format
{
"event": {
"event_id": "abc123def456",
"message": "Failed to process payment",
"level": "error",
"timestamp": 1705312800,
"platform": "javascript",
"tags": {
"environment": "production"
}
},
"project": {
"name": "My Project",
"slug": "my-project"
}
}
Event Mapping
| Sentry Action | OpsKnight Action |
|---|---|
created |
Trigger incident |
resolved |
Resolve incident |
ignored |
Acknowledge incident |
If issue.status is resolved or ignored, the corresponding action is taken regardless of the action field.
Severity Mapping
| Sentry Level | OpsKnight Severity |
|---|---|
fatal |
critical |
error |
error |
warning |
warning |
info |
info |
debug |
info |
Incident Title
The incident title is extracted as:
- Issue format:
issue.title - Event format:
event.messageor "Sentry Error"
The source includes project name: Sentry - {project.name}
Deduplication
Dedup keys are generated as:
- Issue format:
sentry-{issue.id} - Event format:
sentry-{event.event_id}
This ensures the same Sentry issue maps to the same OpsKnight incident.
Testing
Using Sentry UI
- Go to Alerts in Sentry
- Click on your alert rule
- Click Test to send a test notification
- Verify incident appears in OpsKnight
Using cURL
Send a test payload directly:
curl -X POST "https://YOUR_OPSKNIGHT_URL/api/integrations/sentry?integrationId=YOUR_ID" \
-H "Content-Type: application/json" \
-d '{
"action": "created",
"issue": {
"id": "test-001",
"shortId": "TEST-001",
"title": "Test Error from Sentry",
"culprit": "test/file.js",
"level": "error",
"status": "unresolved",
"permalink": "https://sentry.io/test"
},
"project": {
"name": "Test Project",
"slug": "test-project"
}
}'
Troubleshooting
Alerts Not Appearing
- Check webhook URL is correct in Sentry
- Verify integration ID is valid
- Check alert rule is active and conditions are met
- Verify webhook is selected in alert actions
401 Unauthorized Error
- Check signing secret matches in both OpsKnight and Sentry
- Remove secret from OpsKnight if you don't want signature verification
- Verify Sentry is sending the signature header
Issues Not Resolving
- Configure alert rule to also notify on issue resolution
- Check issue status in Sentry
Wrong Severity
- Set error level appropriately in your Sentry SDK
- Use standard levels:
fatal,error,warning,info
Related Topics
- Events API — Programmatic event submission
- Integrations Overview — All integrations
Last updated for v1
Edit this page on GitHub