Documentation
Learn how to integrate Wirl into your application.
Installation
Install the Wirl SDK using your preferred package manager:
npm install wirl
yarn add wirl
pnpm add wirl
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',
});
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 https://app.wirl.dev/api/v1/contacts/:id
PATCH https://app.wirl.dev/api/v1/contacts/:id
Body: { "properties": { "name": "Jane" } }Contact Properties API
Pre-register contact properties so they appear as template variables in the editor. Properties set via identify() or track() are auto-discovered, but registering them adds type info and descriptions.
GET https://app.wirl.dev/api/v1/contacts/properties
POST https://app.wirl.dev/api/v1/contacts/properties
Body: {
"name": "plan",
"type": "string",
"description": "User's plan tier"
}
Supported types: string, number, boolean, date
Use in templates as {{contact.plan}}Templates API
GET https://app.wirl.dev/api/v1/templates
POST https://app.wirl.dev/api/v1/templates
Body: {
"name": "Welcome Email",
"subject": "Welcome to {{workspace.name}}!",
"body_html": "<h1>Welcome!</h1><p>Hi {{contact.name}},</p>"
}
PATCH https://app.wirl.dev/api/v1/templates/:id
Body: { "subject": "New subject line" }
DELETE https://app.wirl.dev/api/v1/templates/:idUse {{contact.email}}, {{contact.name}}, {{workspace.name}}, or any registered property like {{contact.plan}} as template variables.
Sequences API
GET https://app.wirl.dev/api/v1/sequences
GET https://app.wirl.dev/api/v1/sequences/:id
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": "..." }
]
}
PATCH https://app.wirl.dev/api/v1/sequences/:id
Body: { "status": "paused" }
DELETE https://app.wirl.dev/api/v1/sequences/:id
GET https://app.wirl.dev/api/v1/sequences/:id/statsStep types
| Type | Fields | Description |
|---|---|---|
| send | template_id | Send an email using a template |
| wait | duration, unit | Wait before next step. Units: minutes, hours, days |
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
Run this command in your terminal:
claude mcp add --transport http wirl 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
- get_sequence
- create_sequence
- update_sequence
- delete_sequence
- get_sequence_stats
Templates
- list_templates
- get_template
- create_template
- update_template
- delete_template
Contacts
- list_contacts
- get_contact
- find_contact_by_email
- update_contact
- list_properties
- register_property
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?
Get started for free or reach out if you have questions.
Start for free