Skip to main content

Webhook-Based Integrations

New to building integrations? Start with our step-by-step contributor guide for a quick overview.
Webhook-based integrations receive HTTP callbacks from external services for real-time synchronization. This reference guide uses Slack as the detailed example.

When to Use Webhooks

Choose webhook-based integrations when:
  • The service provides real-time webhook events
  • You need instant synchronization (chat messages, notifications)
  • Events are user-triggered and need immediate capture
  • The service has robust webhook infrastructure

Architecture Overview

Event Flow

1. SETUP Event

When a user connects their account via OAuth:

2. IDENTIFY Event

When a webhook event arrives, extract the user identifier for routing:
This tells Core which user’s knowledge graph to update with the activity.

3. PROCESS Event

Process the webhook event and create activity messages:

Full Example: Slack Integration

spec.json

index.ts

create-activity.ts

Best Practices

1. Event Filtering

Only process events that are relevant to the user’s knowledge graph:

2. Context Enrichment

Provide rich context by fetching related data:

3. Deep Linking

Always provide sourceURL for navigation back to the original content:

4. Error Handling

Handle errors gracefully without breaking the integration:

5. User Identification

Properly extract user IDs for different event types:

Testing Webhooks Locally

To test webhooks during development:
  1. Use ngrok for local tunneling:
  2. Configure webhook URL in service (Slack):
  3. Test events by triggering actions in Slack
  4. Check logs for event payloads and processing

Common Event Types

Slack

  • message - New message posted
  • reaction_added - Emoji reaction added
  • reaction_removed - Emoji reaction removed
  • member_joined_channel - User joined channel
  • app_mention - Bot was mentioned

Discord

  • MESSAGE_CREATE - New message
  • MESSAGE_REACTION_ADD - Reaction added
  • GUILD_MEMBER_ADD - Member joined server

Linear

  • Issue - Issue created/updated
  • Comment - Comment added
  • IssueLabel - Label changed

Next Steps