> ## 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.

# reply.received

> Triggered when a reply is received from a lead

This event is triggered when a lead replies to your LinkedIn message.

## When This Event Fires

* A lead responds to a campaign message
* A lead sends a new message in an existing conversation
* Any inbound message is received from a lead

## Payload

```json theme={null}
{
  "eventId": "evt_1708456789123_abc123def",
  "eventType": "reply.received",
  "timestamp": "2024-02-24T14:30:00.000Z",
  "workspaceId": "ws_abc123xyz",
  "data": {
    "leadId": "lead_abc123",
    "campaignId": "camp_xyz789",
    "linkedinUrl": "https://www.linkedin.com/in/john-doe",
    "senderId": "sender_def456",
    "reply": "Hi! Thanks for reaching out. I'd be happy to learn more about your product. How about we schedule a call for next Tuesday at 2pm?"
  }
}
```

## Payload Fields

| Field              | Type   | Description                                     |
| ------------------ | ------ | ----------------------------------------------- |
| `eventId`          | string | Unique event identifier for idempotency         |
| `eventType`        | string | Always `reply.received`                         |
| `timestamp`        | string | ISO 8601 timestamp when the reply was received  |
| `workspaceId`      | string | Your workspace ID                               |
| `data.leadId`      | string | The lead who sent the reply                     |
| `data.campaignId`  | string | The campaign this lead belongs to               |
| `data.linkedinUrl` | string | LinkedIn profile URL of the lead                |
| `data.senderId`    | string | LinkedIn sender account that received the reply |
| `data.reply`       | string | Full reply content from the lead                |

## Use Cases

<CardGroup cols={2}>
  <Card title="CRM Integration" icon="database">
    Log replies in your CRM and update lead status
  </Card>

  <Card title="Notifications" icon="bell">
    Alert sales team immediately when leads respond
  </Card>

  <Card title="AI Analysis" icon="robot">
    Analyze reply sentiment and intent automatically
  </Card>

  <Card title="Auto-Response" icon="reply">
    Trigger automated follow-up workflows
  </Card>
</CardGroup>

## Example Handler

```javascript theme={null}
app.post('/webhooks/sendpilot', (req, res) => {
  const event = req.body;
  
  if (event.eventType === 'reply.received') {
    const { leadId, campaignId, reply } = event.data;
    
    // Update lead status in CRM
    await crm.updateLead(leadId, {
      status: 'replied',
      lastReply: reply,
      repliedAt: event.timestamp
    });
    
    // Send Slack notification
    await slack.notify({
      channel: '#sales-replies',
      text: `🎉 New reply from lead ${leadId}:\n"${reply}"`
    });
    
    console.log(`Reply received from lead ${leadId}`);
  }
  
  res.status(200).send('OK');
});
```

<Note>
  The `reply` field contains the full message content from the lead.
</Note>
