> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sendpilot.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Make.com Integration

> Visual automation platform for complex workflows

Make.com (formerly Integromat) is a powerful visual automation platform that allows you to build complex workflows with a drag-and-drop interface.

## Why Make.com?

* **Visual Builder**: Build complex workflows visually
* **1000+ Integrations**: Connect to major apps and services
* **Advanced Logic**: Routers, filters, iterators, and aggregators
* **Data Transformation**: Built-in functions for data manipulation

## Setting Up SendPilot in Make.com

### Step 1: Create a Webhook Module (Trigger)

1. Create a new Scenario in Make.com
2. Click **+** to add a module
3. Search for **Webhooks** → **Custom Webhook**
4. Click **Add** to create a new webhook
5. Copy the webhook URL

### Step 2: Register Webhook in SendPilot

1. Go to SendPilot **Integrations** → **Webhooks**
2. Click **Add Webhook**
3. Paste your Make.com webhook URL
4. Select events to subscribe to
5. Save

### Step 3: Add HTTP Module for API Calls

For calling SendPilot API:

1. Add **HTTP** → **Make a Request** module
2. Configure:
   * URL: `https://api.sendpilot.ai/v1/leads`
   * Method: `POST`
   * Headers:
     * `X-API-Key`: `YOUR_API_KEY`
     * `Content-Type`: `application/json`
   * Body: Your JSON payload

## Example Scenarios

### 1. Reply Handler → Slack + CRM

**Scenario Flow:**

```
[Webhook: SendPilot Events]
    → [Router]
        → Path 1 (Reply): [Slack] → [HubSpot]
        → Path 2 (Connection): [Slack]
```

**Webhook Module:**

* Name: "SendPilot Events"
* Data Structure: Select "Add" to define the payload structure

**Router Filters:**

* Path 1: `eventType` = `message.received`
* Path 2: `eventType` = `connection.accepted`

**Slack Module:**

* Channel: `#sales-leads`
* Text: `🎉 {{1.data.leadId}} replied: {{1.data.replyPreview}}`

### 2. Google Sheets → Add Leads

**Scenario Flow:**

```
[Schedule: Every Hour]
    → [Google Sheets: Search Rows (status = "new")]
    → [Iterator]
    → [HTTP: POST /v1/leads]
    → [Google Sheets: Update Row (status = "sent")]
```

**HTTP Module Configuration:**

```json theme={null}
{
  "url": "https://api.sendpilot.ai/v1/leads",
  "method": "POST",
  "headers": [
    {
      "name": "X-API-Key",
      "value": "YOUR_API_KEY"
    },
    {
      "name": "Content-Type",
      "value": "application/json"
    }
  ],
  "body": {
    "campaignId": "your_campaign_id",
    "leads": [
      {
        "linkedinUrl": "{{iterator.linkedinUrl}}",
        "firstName": "{{iterator.firstName}}",
        "lastName": "{{iterator.lastName}}",
        "company": "{{iterator.company}}"
      }
    ]
  }
}
```

### 3. Connection Accepted → Full Enrichment Flow

**Scenario Flow:**

```
[Webhook: connection.accepted]
    → [HTTP: Clearbit Enrichment]
    → [Data Store: Save enrichment]
    → [Set Variables]
    → [Salesforce: Update Contact]
    → [Slack: Notify team]
```

### 4. Multi-Channel Campaign Management

**Scenario Flow:**

```
[Webhook: lead.status.changed]
    → [Router]
        → [newStatus = REPLY_RECEIVED]: 
            [HTTP: PATCH /v1/leads/:id/status]
            [Intercom: Tag User]
        → [newStatus = DONE]: 
            [HTTP: PATCH /v1/campaigns/:id (pause)]
            [Slack: Campaign goal reached!]
```

## Setting Up Data Structures

Define the webhook payload structure for better mapping:

1. Click on the webhook module
2. Click **Add** next to Data Structure
3. Name it: "SendPilot Webhook Event"
4. Add fields:

```json theme={null}
{
  "eventId": "string",
  "eventType": "string",
  "timestamp": "date",
  "workspaceId": "string",
  "data": {
    "leadId": "string",
    "campaignId": "string",
    "linkedinUrl": "string",
    "replyPreview": "string"
  }
}
```

## HTTP Module Templates

### Add Leads to Campaign

```
Module: HTTP - Make a Request
URL: https://api.sendpilot.ai/v1/leads
Method: POST
Headers:
  X-API-Key: {{YOUR_API_KEY}}
  Content-Type: application/json
Body Type: Raw
Content Type: JSON
Request Content:
{
  "campaignId": "{{campaignId}}",
  "leads": [
    {
      "linkedinUrl": "{{linkedinUrl}}",
      "firstName": "{{firstName}}",
      "lastName": "{{lastName}}",
      "company": "{{company}}"
    }
  ]
}
```

### Update Lead Status

```
Module: HTTP - Make a Request
URL: https://api.sendpilot.ai/v1/leads/{{leadId}}/status
Method: PATCH
Headers:
  X-API-Key: {{YOUR_API_KEY}}
  Content-Type: application/json
Body Type: Raw
Content Type: JSON
Request Content:
{
  "status": "DONE",
  "note": "Converted via automation"
}
```

### Pause Campaign

```
Module: HTTP - Make a Request
URL: https://api.sendpilot.ai/v1/campaigns/{{campaignId}}
Method: PATCH
Headers:
  X-API-Key: {{YOUR_API_KEY}}
  Content-Type: application/json
Request Content:
{
  "action": "pause"
}
```

### Get Campaign Details

```
Module: HTTP - Make a Request
URL: https://api.sendpilot.ai/v1/campaigns/{{campaignId}}
Method: GET
Headers:
  X-API-Key: {{YOUR_API_KEY}}
```

## Using Routers

Routers let you handle different event types in one scenario:

```
[Webhook]
    → [Router]
        → Filter: eventType = message.sent
            → [Slack: "Message sent to {{leadId}}"]
        → Filter: eventType = message.received
            → [HubSpot: Create Task]
            → [Slack: "Reply from {{leadId}}!"]
        → Filter: eventType = connection.accepted
            → [Salesforce: Update Lead Status]
        → Fallback (no filter)
            → [Logger: Store event for analysis]
```

## Error Handling

Make.com provides robust error handling:

1. **Error Handler Module**: Add after any module
2. **Break**: Stop scenario on error
3. **Resume**: Continue with fallback value
4. **Commit**: Save data and continue
5. **Rollback**: Undo all changes

**Example:**

```
[HTTP Request]
    → Success: [Continue]
    → Error: [Error Handler]
        → [Slack: Alert ops team]
        → [Break]
```

## Best Practices

<AccordionGroup>
  <Accordion title="Use Variables">
    Store your API key in scenario variables or Team variables for easy management.
  </Accordion>

  <Accordion title="Add Filters Early">
    Filter webhook events early to save operations.
  </Accordion>

  <Accordion title="Use Data Stores">
    Cache enrichment data in Make.com Data Stores to avoid redundant API calls.
  </Accordion>

  <Accordion title="Schedule Strategically">
    For bulk operations, schedule during off-peak hours.
  </Accordion>

  <Accordion title="Test with History">
    Use Make.com's history feature to replay and debug scenarios.
  </Accordion>
</AccordionGroup>

## Scenario Blueprint

Here's a complete blueprint you can import:

```json theme={null}
{
  "name": "SendPilot Reply Handler",
  "flow": [
    {
      "id": 1,
      "module": "gateway:CustomWebHook",
      "mapper": {
        "name": "SendPilot Events"
      }
    },
    {
      "id": 2,
      "module": "builtin:BasicRouter"
    },
    {
      "id": 3,
      "module": "slack:CreateMessage",
      "mapper": {
        "channel": "#sales-leads",
        "text": "🎉 Reply from {{1.data.linkedinUrl}}"
      },
      "filter": {
        "name": "Reply Events",
        "conditions": [
          {
            "a": "{{1.eventType}}",
            "o": "text:equal",
            "b": "message.received"
          }
        ]
      }
    }
  ]
}
```

## Pricing Considerations

Make.com uses operations-based pricing:

* Each module execution = 1 operation
* Webhooks trigger 1 operation per event
* Use filters to minimize unnecessary operations

<Tip>
  Use the **Ignore** module to test webhook payloads without consuming operations during development.
</Tip>
