Build custom Linear integrations using webhooks. Complete developer guide with examples, security, and best practices.
Use Linear webhooks to build custom integrations and automate workflows with any external system or application.
Set up an HTTP endpoint to receive webhook payloads from Linear.
// Express.js webhook endpoint example
app.post('/linear-webhook', (req, res) => {
const payload = req.body;
const signature = req.headers['linear-signature'];
// Verify webhook signature
if (!verifySignature(payload, signature)) {
return res.status(401).send('Unauthorized');
}
// Process the webhook
handleLinearEvent(payload);
res.status(200).send('OK');
});Add your endpoint URL in Linear workspace settings and select which events to receive.
# Webhook configuration: URL: https://yourapp.com/linear-webhook Events: issue.create, issue.update, comment.create Secret: your-webhook-secret-key
Verify webhook authenticity using the signature header to ensure security.
const crypto = require('crypto');
function verifySignature(payload, signature) {
const expectedSignature = crypto
.createHmac('sha256', process.env.WEBHOOK_SECRET)
.update(JSON.stringify(payload))
.digest('hex');
return signature === `sha256=${expectedSignature}`;
}Process different event types and implement your custom logic.
function handleLinearEvent(payload) {
switch (payload.action) {
case 'create':
handleIssueCreated(payload.data);
break;
case 'update':
handleIssueUpdated(payload.data, payload.updatedFrom);
break;
case 'remove':
handleIssueDeleted(payload.data);
break;
}
}Add retry logic and error handling for robust webhook processing.
Check that your endpoint is publicly accessible, returns 200 OK, and the URL is correctly configured in Linear.
Ensure you're using the correct webhook secret and following the exact signature calculation process.
Optimize your endpoint response time (Linear expects response within 10 seconds) and consider async processing.
Start with linear.gratis and connect your Webhooks workflow. Free setup, no limits, ready in minutes.