Overview

Kakiyo webhooks allow you to receive real-time notifications when specific events occur within your LinkedIn outreach campaigns. This enables you to integrate Kakiyo with your existing tools and workflows, such as CRM systems, email platforms, or custom applications.

How Webhooks Work

  1. You create a webhook endpoint (URL) on your server that can receive POST requests
  2. You register this endpoint with Kakiyo, specifying which events you want to receive
  3. When a matching event occurs, Kakiyo sends a POST request to your endpoint with event data
  4. Your server processes the webhook payload and takes appropriate actions

Available Events

Kakiyo supports the following webhook events:

Event IDDescription
linkedin.message.sentTriggered when an agent sends a message to a prospect
linkedin.message.receivedTriggered when a prospect responds to an agent
linkedin.invitation.sentTriggered when an agent sends a connection invitation
linkedin.invitation.acceptedTriggered when a prospect accepts a connection invitation
prospect.qualification.manualTriggered when a prospect requires manual qualification review
prospect.unqualifiedTriggered when a prospect is automatically marked as unqualified

You can also use the wildcard event * to subscribe to all available events.

Webhook Payload

When an event occurs, Kakiyo sends a JSON payload to your webhook endpoint. Here’s an example payload for a linkedin.message.received event:

{
  "event": "linkedin.message.received",
  "teamId": "team_12345abcde",
  "timestamp": "2023-06-15T10:30:00Z",
  "data": {
    "agentId": "agent_67890",
    "campaignId": "campaign_12345",
    "chatId": "chat_54321",
    "prospectId": "prospect_98765",
    "message": "Thanks for reaching out! I'd be interested in learning more...",
    "timestamp": "2023-06-15T10:30:00Z"
  }
}

Securing Webhooks

To ensure that webhook requests are coming from Kakiyo, we include a signature in the X-Kakiyo-Signature header. This signature is an HMAC SHA-256 hash of the request payload, using your webhook secret as the key.

Here’s how to verify the signature:

const crypto = require('crypto');

function verifyWebhookSignature(payload, signature, secret) {
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(JSON.stringify(payload))
.digest('hex');

return signature === expectedSignature;
}

// In your webhook handler
function handleWebhook(req, res) {
const signature = req.headers['x-kakiyo-signature'];
const payload = req.body;
const secret = 'your_webhook_secret';

if (!verifyWebhookSignature(payload, signature, secret)) {
return res.status(401).send('Invalid signature');
}

// Process the webhook
console.log(`Received event: ${payload.event}`);

// Your webhook handling logic here

res.status(200).send('Webhook received');
}

Testing Webhooks

You can test your webhook integration without waiting for real events to occur. Kakiyo provides a test endpoint that allows you to send a test webhook to your registered endpoints:

const axios = require('axios');

const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.kakiyo.com/v1';

async function testWebhook() {
try {
const response = await axios.post(
`${BASE_URL}/webhooks/test`,
{
event: "linkedin.message.received",
data: {
// Optional custom test data
message: "This is a test message"
}
},
{
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
}
);

console.log('Test webhook sent:', response.data);
return response.data;
} catch (error) {
console.error('Error testing webhook:', error.response ? error.response.data : error.message);
throw error;
}
}

testWebhook();

You can also get example payloads for each event type to help you build your integration:

async function getWebhookExample(eventType) {
try {
const response = await axios.get(
`${BASE_URL}/webhooks/test/example/${eventType}`,
{
headers: {
'Authorization': `Bearer ${API_KEY}`
}
}
);

console.log('Example payload:', response.data);
return response.data;
} catch (error) {
console.error('Error getting example:', error.response ? error.response.data : error.message);
throw error;
}
}

getWebhookExample('linkedin.message.received');