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

# Create activity

> Log conversation activity (LinkedIn, email, etc.)

<Card title="Your Implementation Required" icon="triangle-exclamation" color="#f59e0b">
  This endpoint must be implemented on **your server**
</Card>

Enginy calls this endpoint to log conversation activity from campaigns including LinkedIn messages, emails, InMails, and connection requests.

## Request

<ParamField body="type" type="string" required>
  Activity type: `EMAIL`, `LINKEDIN`, `LINKEDIN_CONNECTION`, `LINKEDIN_INMAIL`
</ParamField>

<ParamField body="subject" type="string">
  Activity subject (formatted with sequence info and sender)
</ParamField>

<ParamField body="body" type="string">
  Message body content (may include HTML for emails)
</ParamField>

<ParamField body="direction" type="string">
  `INBOUND` (from contact) or `OUTBOUND` (from your team)
</ParamField>

<ParamField body="ownerId" type="string">
  Owner/sender user ID in your CRM
</ParamField>

<ParamField body="occurredAt" type="string">
  When the activity happened (ISO 8601)
</ParamField>

<ParamField body="contactId" type="string">
  Associated contact's CRM ID
</ParamField>

<ParamField body="companyId" type="string">
  Associated company's CRM ID
</ParamField>

<ParamField body="metadata" type="object">
  Additional metadata (messageId, sequenceIndex, sequenceMessageCount)
</ParamField>

<RequestExample>
  ```json theme={null}
  {
    "type": "LINKEDIN",
    "subject": "[1/3] [FROM Acme Corp] John Smith",
    "body": "Hi Jane, I noticed your company is expanding...",
    "direction": "OUTBOUND",
    "ownerId": "user-123",
    "occurredAt": "2024-12-31T10:00:00Z",
    "contactId": "contact_8f3k2j",
    "companyId": "account_4k8j2m",
    "metadata": {
      "messageId": "linkedin-msg-123",
      "sequenceIndex": 1,
      "sequenceMessageCount": 3
    }
  }
  ```
</RequestExample>

## Response

Return the created activity with at least an `id` field.

<ResponseField name="id" type="string" required>
  Unique identifier for the activity (required to prevent duplicates)
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
    "id": "activity-abc123",
    "type": "LINKEDIN",
    "subject": "[1/3] [FROM Acme Corp] John Smith",
    "direction": "OUTBOUND",
    "occurredAt": "2024-12-31T10:00:00Z"
  }
  ```
</ResponseExample>

## Activity Types

| Type                  | Description                       |
| --------------------- | --------------------------------- |
| `EMAIL`               | Email messages sent/received      |
| `LINKEDIN`            | LinkedIn messages sent/received   |
| `LINKEDIN_INMAIL`     | LinkedIn InMail sent/received     |
| `LINKEDIN_CONNECTION` | Connection requests sent/accepted |

## Subject Format

Enginy formats subjects to provide context:

**Outbound**: `[{index}/{total}] [FROM {Company}] {SenderName}`

```
[1/3] [FROM Acme Corp] John Smith
```

**Inbound**: `[{ContactCompany}] {ContactName}`

```
[TechStartup Inc] Jane Doe
```

<Warning>
  The `id` field is **required** in the response. Enginy stores this ID to prevent duplicate activity logs.
</Warning>
