Skip to main content

Your Implementation Required

This endpoint must be implemented on your server
Enginy logs conversation activity (LinkedIn messages, InMails, connection requests, and emails) to your Custom CRM. Implement this endpoint so Enginy can create activity records whenever a message is sent or received.

When Activities Are Created

Enginy creates activity records when:
EventActivity TypeDirection
LinkedIn message sentLINKEDINOUTBOUND
LinkedIn message receivedLINKEDININBOUND
LinkedIn InMail sentLINKEDIN_INMAILOUTBOUND
LinkedIn InMail receivedLINKEDIN_INMAILINBOUND
Connection request sentLINKEDIN_CONNECTIONOUTBOUND
Connection request acceptedLINKEDIN_CONNECTIONINBOUND
Email sentEMAILOUTBOUND
Email receivedEMAILINBOUND
Activities are only logged for campaigns with message sync enabled. Configure this in your campaign settings.

Subject Format

Enginy formats the subject field to provide context about the message: Outbound messages (from your team):
[{sequenceIndex}/{sequenceCount}] [FROM {YourCompany}] {SenderName}
Example: [1/3] [FROM Acme Corp] John Smith Inbound messages (from the contact):
[{ContactCompany}] {ContactFirstName} {ContactLastName}
Example: [TechStartup Inc] Jane Doe
The sequence index (e.g., [1/3]) indicates this is message 1 of 3 in the sequence. This helps track campaign progress.

Create Activity

Creates a new activity record in your CRM.
POST /activities

Request Body

FieldTypeRequiredDescription
typestringYesActivity type: EMAIL, LINKEDIN, LINKEDIN_CONNECTION, LINKEDIN_INMAIL
subjectstringNoActivity subject/title
bodystringNoActivity body or message content (may include HTML)
directionstringNoINBOUND or OUTBOUND
ownerIdstringNoOwner/user ID in your CRM
occurredAtstring (ISO 8601)NoWhen the activity happened
contactIdstringNoAssociated contact/lead CRM ID
companyIdstringNoAssociated company CRM ID
metadataobjectNoOptional metadata (e.g., sequence index, message ID)
Typical metadata keys include messageId, sequenceIndex, and sequenceMessageCount. You can store them for traceability or ignore them.

Example: Email Activity

{
  "type": "EMAIL",
  "subject": "[1/3] Re: Partnership Opportunity",
  "body": "<div>Hi Jane, Thanks for your interest...</div>",
  "direction": "OUTBOUND",
  "ownerId": "user-123",
  "occurredAt": "2024-12-31T10:00:00Z",
  "contactId": "contact-456",
  "companyId": "company-789",
  "metadata": {
    "sequenceIndex": 1,
    "sequenceMessageCount": 3,
    "messageId": "msg-abc123"
  }
}

Example: LinkedIn Outbound Message

{
  "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-456",
  "companyId": "company-789",
  "metadata": {
    "messageId": "linkedin-msg-123",
    "sequenceIndex": 1,
    "sequenceMessageCount": 3
  }
}

Example: LinkedIn Inbound Reply

{
  "type": "LINKEDIN",
  "subject": "[TechStartup Inc] Jane Doe",
  "body": "Thanks for reaching out. Happy to chat!",
  "direction": "INBOUND",
  "ownerId": "user-123",
  "occurredAt": "2024-12-31T11:00:00Z",
  "contactId": "contact-456",
  "companyId": "company-789",
  "metadata": {
    "messageId": "linkedin-msg-456"
  }
}

Response

Return the created activity with at least an id field:
{
  "id": "activity-abc123",
  "type": "EMAIL",
  "subject": "[1/3] Re: Partnership Opportunity",
  "direction": "OUTBOUND",
  "occurredAt": "2024-12-31T10:00:00Z"
}
The id field is required in the response. Enginy stores this ID to prevent duplicate activity logs.

Activity Schema Reference

FieldTypeRequiredDescription
idstringYes (response)Unique identifier for the activity
typestringYesEMAIL, LINKEDIN, LINKEDIN_CONNECTION, LINKEDIN_INMAIL
subjectstringNoActivity subject/title
bodystringNoActivity body/content (may contain HTML)
directionstringNoINBOUND or OUTBOUND
ownerIdstringNoAssigned user ID
occurredAtstring (ISO 8601)NoTimestamp of the activity
contactIdstringNoAssociated contact/lead CRM ID
companyIdstringNoAssociated company CRM ID
metadataobjectNoAdditional metadata

Testing Your Activities API

1

Test Email Activity

curl -X POST https://your-api.com/activities \
  -H "X-API-Key: your-secret-key" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "EMAIL",
    "subject": "Test email activity",
    "direction": "OUTBOUND",
    "contactId": "contact-123"
  }'
2

Test LinkedIn Activity

curl -X POST https://your-api.com/activities \
  -H "X-API-Key: your-secret-key" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "LINKEDIN",
    "subject": "[1/3] [FROM Acme] John Smith",
    "body": "Hi, I wanted to connect...",
    "direction": "OUTBOUND",
    "contactId": "contact-123"
  }'
3

Verify Response

Ensure your response includes an id field:
{
  "id": "activity-xyz789"
}

Reference Implementation

GitHub Repository

See a complete working implementation of the activities endpoint, including how to display activities in contact/company detail pages.