Documentation
Learn how to integrate Wirl into your application.
Installation
Install the Wirl SDK using your preferred package manager:
Quick Start
Initialize the SDK with your API key and start tracking events:
import Wirl from 'wirl';
const wirl = new Wirl({
apiKey: 'sk_live_your_api_key',
});
// Track a signup event
await wirl.track({
email: 'user@example.com',
event: 'user.signup',
properties: {
plan: 'pro',
source: 'landing-page'
}
});Get your API key from the Settings page in your dashboard.
Configuration
The Wirl constructor accepts the following options:
| Option | Type | Description |
|---|---|---|
| apiKey | string | Required. Your Wirl API key. |
| baseUrl | string | Optional. API base URL. Defaults to production. |
track()
Track an event for a contact. If the contact doesn't exist, it will be created automatically. This is the primary method for triggering email sequences.
await wirl.track({
email: 'user@example.com', // Required
event: 'user.signup', // Required
properties: { // Optional
plan: 'pro',
company: 'Acme Inc'
}
});Parameters
| Contact's email address | |
| event | Event name (e.g., "user.signup", "order.completed") |
| properties | Optional object with additional data |
identify()
Update a contact's properties without tracking an event. Useful for enriching contact data.
await wirl.identify({
email: 'user@example.com',
properties: {
name: 'Jane Smith',
company: 'Acme Inc',
role: 'Developer'
}
});trigger()
Manually enroll a contact in a specific sequence. Use this when you want to start a sequence without tracking an event.
await wirl.trigger({
email: 'user@example.com',
sequence: 'onboarding' // Sequence name or ID
});exit()
Remove a contact from a sequence early. Useful when a user takes an action that should stop the sequence (e.g., they upgraded, so stop the upgrade reminder emails).
await wirl.exit({
email: 'user@example.com',
sequence: 'trial-reminder'
});Events API
If you prefer to use the REST API directly instead of the SDK:
POST https://app.wirl.dev/api/v1/events
Headers:
Authorization: Bearer sk_live_your_api_key
Content-Type: application/json
Body:
{
"email": "user@example.com",
"event": "user.signup",
"properties": {
"plan": "pro"
}
}Contacts API
# Get a contact
GET https://app.wirl.dev/api/v1/contacts/:id
# Update a contact
PATCH https://app.wirl.dev/api/v1/contacts/:id
Body: { "properties": { "name": "Jane" } }Sequences API
# List sequences
GET https://app.wirl.dev/api/v1/sequences
# Create a sequence
POST https://app.wirl.dev/api/v1/sequences
Body: {
"name": "Welcome Sequence",
"trigger_event": "user.signup",
"status": "active",
"steps": [
{ "type": "send", "template_id": "..." },
{ "type": "wait", "duration": 2, "unit": "days" },
{ "type": "send", "template_id": "..." }
]
}MCP Integration
Wirl provides an MCP (Model Context Protocol) server that lets AI assistants like Claude manage your email sequences, templates, and contacts directly.
Claude Code
Add to your .mcp.json:
{
"mcpServers": {
"wirl": {
"url": "https://app.wirl.dev/mcp"
}
}
}Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"wirl": {
"url": "https://app.wirl.dev/mcp"
}
}
}MCP Authentication
After adding the MCP config, authenticate using the /mcp command:
claude /mcp # Select "wirl" → "Authenticate"
This will:
- Open a browser window
- Log in to your Wirl account
- Grant access to Claude
Once authenticated, Claude can manage your sequences, templates, and contacts.
Available MCP Tools
Once connected, Claude can use these tools to manage your email automation:
Sequences
- list_sequences
- create_sequence
- update_sequence
- get_sequence_stats
Templates
- list_templates
- create_template
- update_template
- delete_template
Contacts
- list_contacts
- find_contact_by_email
- update_contact
Events
- track_event
- list_events
- trigger_sequence
- exit_sequence
Example prompts: "Create a welcome sequence triggered by user.signup" or "Why isn't user@example.com receiving emails?"
Need help?
Check out the source code or open an issue on GitHub.
View on GitHub