Back to Support Center

Webhooks

Real-time event notifications through secure webhooks.

Getting Started

Configure Endpoint

Set up a publicly accessible HTTPS endpoint to receive webhook events

Generate Secret

Create a webhook secret to verify event authenticity

Subscribe to Events

Choose which events you want to receive notifications for

Handle Events

Process webhook payloads and implement your business logic

Available Events

crop.analysis.completed

Triggered when crop analysis is completed

{
  "crop_id": "crop_123",
  "health_score": 0.85,
  "analysis_date": "2024-04-15T10:30:00Z",
  "recommendations": [
    "Increase irrigation",
    "Monitor nitrogen levels"
  ]
}

alert.created

Triggered when a new alert is generated

{
  "alert_id": "alert_456",
  "severity": "high",
  "type": "pest_detection",
  "message": "Potential pest infestation detected in Field A"
}

resource.threshold.exceeded

Triggered when resource usage exceeds threshold

{
  "resource_type": "water",
  "current_value": 150,
  "threshold": 100,
  "field_id": "field_789",
  "timestamp": "2024-04-15T14:20:00Z"
}

Security Considerations

Signature Verification

Always verify webhook signatures using your secret key

HTTPS Only

Only accept webhooks over secure HTTPS connections

Timeout Handling

Implement proper timeout handling for webhook processing

Retry Logic

Handle failed deliveries with exponential backoff

Node.js Example
const express = require('express');
const crypto = require('crypto');

const app = express();

app.post('/webhook', express.raw({type: 'application/json'}), (req, res) => {
  const signature = req.headers['x-kisan-signature'];
  const payload = req.body;
  
  // Verify signature
  const isValid = verifySignature(payload, signature, process.env.WEBHOOK_SECRET);
  if (!isValid) {
    return res.status(400).send('Invalid signature');
  }

  // Handle the event
  const event = JSON.parse(payload);
  console.log('Received event:', event.type);
  
  res.json({received: true});
});

Ready to Implement Webhooks?

Start receiving real-time updates for your application.