Skip to main content

Conversations

The Conversations API allows you to manage conversations between your organization and contacts across all messaging channels.

Overview​

A conversation represents an ongoing dialogue with a contact. Conversations can span multiple messages, sessions, and even channels (when contacts switch platforms). Each conversation has a lifecycle from creation to closure.

Endpoints​

MethodEndpointDescription
GET/conversationsList all conversations
GET/conversations/:idGet a specific conversation
POST/conversationsCreate a new conversation
PATCH/conversations/:idUpdate a conversation
POST/conversations/:id/closeClose a conversation
POST/conversations/:id/reopenReopen a closed conversation
POST/conversations/:id/assignAssign conversation to user/bot
POST/conversations/:id/transferTransfer to another assignee
GET/conversations/:id/participantsList conversation participants

List Conversations​

Retrieve a paginated list of conversations.

GET /conversations

Query Parameters​

ParameterTypeDefaultDescription
pageinteger1Page number
perPageinteger20Items per page (max: 100)
statusstring-Filter by status: open, pending, closed
channelIdstring-Filter by channel ID
channelTypestring-Filter by channel type
assigneeIdstring-Filter by assignee (user or bot ID)
contactIdstring-Filter by contact ID
botIdstring-Filter by assigned bot
startDatestring-Filter by created date (ISO 8601)
endDatestring-Filter by created date (ISO 8601)
searchstring-Search in contact name or messages
sortBystringupdatedAtSort field
sortOrderstringdescSort order: asc or desc

Example Request​

curl "https://api.linktor.io/v1/conversations?status=open&channelType=whatsapp&perPage=50" \
-H "Authorization: Bearer YOUR_API_KEY"

Response​

{
"data": [
{
"id": "conv_abc123",
"type": "conversation",
"attributes": {
"status": "open",
"channel": {
"id": "ch_xyz789",
"type": "whatsapp",
"name": "WhatsApp Business"
},
"contact": {
"id": "contact_123",
"name": "John Doe",
"phone": "+5511999999999",
"avatar": "https://cdn.linktor.io/avatars/contact_123.jpg"
},
"assignee": {
"id": "user_456",
"type": "user",
"name": "Support Agent"
},
"lastMessage": {
"id": "msg_789",
"content": {
"type": "text",
"text": "Thanks for your help!"
},
"direction": "inbound",
"timestamp": "2024-01-15T10:35:00Z"
},
"unreadCount": 2,
"messageCount": 15,
"metadata": {
"source": "website",
"campaign": "winter_sale"
},
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:35:00Z"
}
}
],
"meta": {
"pagination": {
"page": 1,
"perPage": 50,
"totalPages": 10,
"totalCount": 500
}
}
}

Get Conversation​

Retrieve a specific conversation by ID.

GET /conversations/:id

Path Parameters​

ParameterTypeDescription
idstringConversation ID

Query Parameters​

ParameterTypeDefaultDescription
includeMessagesbooleanfalseInclude recent messages
messageLimitinteger20Number of messages to include

Example Request​

curl "https://api.linktor.io/v1/conversations/conv_abc123?includeMessages=true&messageLimit=10" \
-H "Authorization: Bearer YOUR_API_KEY"

Response​

{
"data": {
"id": "conv_abc123",
"type": "conversation",
"attributes": {
"status": "open",
"channel": {
"id": "ch_xyz789",
"type": "whatsapp",
"name": "WhatsApp Business"
},
"contact": {
"id": "contact_123",
"name": "John Doe",
"phone": "+5511999999999",
"email": "john@example.com",
"avatar": "https://cdn.linktor.io/avatars/contact_123.jpg",
"metadata": {
"customerId": "cust_789",
"tier": "premium"
}
},
"assignee": {
"id": "user_456",
"type": "user",
"name": "Support Agent"
},
"bot": {
"id": "bot_abc",
"name": "Support Bot",
"active": true
},
"unreadCount": 2,
"messageCount": 15,
"firstMessageAt": "2024-01-15T10:00:00Z",
"lastMessageAt": "2024-01-15T10:35:00Z",
"metadata": {
"source": "website",
"campaign": "winter_sale",
"intent": "order_status"
},
"tags": ["vip", "order-issue"],
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:35:00Z"
},
"relationships": {
"messages": [
{
"id": "msg_001",
"direction": "inbound",
"content": {
"type": "text",
"text": "Hi, I need help with my order"
},
"timestamp": "2024-01-15T10:00:00Z"
},
{
"id": "msg_002",
"direction": "outbound",
"content": {
"type": "text",
"text": "Hello! I'd be happy to help. What's your order number?"
},
"timestamp": "2024-01-15T10:01:00Z"
}
]
}
}
}

Error Codes​

HTTP StatusError CodeDescription
404CONVERSATION_NOT_FOUNDConversation does not exist

Create Conversation​

Create a new conversation with a contact.

POST /conversations

Request Body​

FieldTypeRequiredDescription
channelIdstringYesChannel ID to use
contactIdstringNoExisting contact ID
contactobjectNoNew contact details (if contactId not provided)
contact.phonestringConditionalContact phone (E.164 format)
contact.emailstringConditionalContact email
contact.namestringNoContact display name
assigneeIdstringNoUser or bot ID to assign
botIdstringNoBot to handle conversation
metadataobjectNoCustom metadata
tagsarrayNoArray of tag strings

Example Request​

curl -X POST https://api.linktor.io/v1/conversations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channelId": "ch_xyz789",
"contact": {
"phone": "+5511999999999",
"name": "Jane Smith"
},
"botId": "bot_abc",
"metadata": {
"source": "api",
"orderId": "order_12345"
},
"tags": ["api-created", "order-inquiry"]
}'

Response​

{
"data": {
"id": "conv_new123",
"type": "conversation",
"attributes": {
"status": "open",
"channel": {
"id": "ch_xyz789",
"type": "whatsapp",
"name": "WhatsApp Business"
},
"contact": {
"id": "contact_new456",
"name": "Jane Smith",
"phone": "+5511999999999"
},
"bot": {
"id": "bot_abc",
"name": "Support Bot",
"active": true
},
"unreadCount": 0,
"messageCount": 0,
"metadata": {
"source": "api",
"orderId": "order_12345"
},
"tags": ["api-created", "order-inquiry"],
"createdAt": "2024-01-15T11:00:00Z",
"updatedAt": "2024-01-15T11:00:00Z"
}
}
}

Error Codes​

HTTP StatusError CodeDescription
400VALIDATION_ERRORInvalid request parameters
404CHANNEL_NOT_FOUNDChannel does not exist
404CONTACT_NOT_FOUNDContact ID not found
409CONVERSATION_EXISTSActive conversation already exists

Update Conversation​

Update conversation properties.

PATCH /conversations/:id

Path Parameters​

ParameterTypeDescription
idstringConversation ID

Request Body​

FieldTypeDescription
statusstringConversation status
metadataobjectCustom metadata (merged with existing)
tagsarrayReplace tags array
prioritystringPriority: low, normal, high, urgent

Example Request​

curl -X PATCH https://api.linktor.io/v1/conversations/conv_abc123 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"priority": "high",
"metadata": {
"escalationReason": "customer_request"
},
"tags": ["vip", "escalated"]
}'

Response​

{
"data": {
"id": "conv_abc123",
"type": "conversation",
"attributes": {
"status": "open",
"priority": "high",
"metadata": {
"source": "website",
"escalationReason": "customer_request"
},
"tags": ["vip", "escalated"],
"updatedAt": "2024-01-15T11:30:00Z"
}
}
}

Close Conversation​

Mark a conversation as closed.

POST /conversations/:id/close

Path Parameters​

ParameterTypeDescription
idstringConversation ID

Request Body​

FieldTypeRequiredDescription
reasonstringNoClosure reason
resolutionstringNoResolution status: resolved, unresolved, spam
notesstringNoInternal notes

Example Request​

curl -X POST https://api.linktor.io/v1/conversations/conv_abc123/close \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "Issue resolved",
"resolution": "resolved",
"notes": "Customer was happy with the refund"
}'

Response​

{
"data": {
"id": "conv_abc123",
"type": "conversation",
"attributes": {
"status": "closed",
"closedAt": "2024-01-15T12:00:00Z",
"closedBy": {
"id": "user_456",
"name": "Support Agent"
},
"resolution": "resolved",
"closureReason": "Issue resolved"
}
}
}

Reopen Conversation​

Reopen a closed conversation.

POST /conversations/:id/reopen

Path Parameters​

ParameterTypeDescription
idstringConversation ID

Example Request​

curl -X POST https://api.linktor.io/v1/conversations/conv_abc123/reopen \
-H "Authorization: Bearer YOUR_API_KEY"

Response​

{
"data": {
"id": "conv_abc123",
"type": "conversation",
"attributes": {
"status": "open",
"reopenedAt": "2024-01-15T14:00:00Z",
"reopenedBy": {
"id": "user_456",
"name": "Support Agent"
}
}
}
}

Assign Conversation​

Assign a conversation to a user or bot.

POST /conversations/:id/assign

Path Parameters​

ParameterTypeDescription
idstringConversation ID

Request Body​

FieldTypeRequiredDescription
assigneeIdstringYesUser ID or Bot ID
assigneeTypestringNouser or bot (auto-detected)
notestringNoAssignment note

Example Request​

curl -X POST https://api.linktor.io/v1/conversations/conv_abc123/assign \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"assigneeId": "user_789",
"note": "Escalated to senior support"
}'

Response​

{
"data": {
"id": "conv_abc123",
"type": "conversation",
"attributes": {
"assignee": {
"id": "user_789",
"type": "user",
"name": "Senior Support Agent"
},
"assignedAt": "2024-01-15T12:30:00Z",
"assignedBy": {
"id": "user_456",
"name": "Support Agent"
}
}
}
}

Transfer Conversation​

Transfer a conversation to another assignee with handoff context.

POST /conversations/:id/transfer

Request Body​

FieldTypeRequiredDescription
toAssigneeIdstringYesNew assignee ID
reasonstringNoTransfer reason
summarystringNoConversation summary for new assignee
notifyContactbooleanNoSend transfer notification to contact

Example Request​

curl -X POST https://api.linktor.io/v1/conversations/conv_abc123/transfer \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"toAssigneeId": "user_expert",
"reason": "Technical issue",
"summary": "Customer has a billing dispute from last month. Needs access to invoice #12345.",
"notifyContact": true
}'

Get Participants​

List all participants in a conversation.

GET /conversations/:id/participants

Example Request​

curl https://api.linktor.io/v1/conversations/conv_abc123/participants \
-H "Authorization: Bearer YOUR_API_KEY"

Response​

{
"data": [
{
"id": "contact_123",
"type": "contact",
"attributes": {
"name": "John Doe",
"phone": "+5511999999999",
"role": "customer"
}
},
{
"id": "user_456",
"type": "user",
"attributes": {
"name": "Support Agent",
"email": "agent@company.com",
"role": "agent"
}
},
{
"id": "bot_abc",
"type": "bot",
"attributes": {
"name": "Support Bot",
"role": "bot"
}
}
]
}

Conversation Statuses​

StatusDescription
openActive conversation awaiting response
pendingWaiting for customer response
snoozedTemporarily hidden, will reopen at scheduled time
closedConversation resolved and closed

Webhooks​

Conversation events can be received via webhooks:

  • conversation.created - New conversation started
  • conversation.updated - Conversation properties changed
  • conversation.assigned - Conversation assigned to user/bot
  • conversation.transferred - Conversation transferred
  • conversation.closed - Conversation closed
  • conversation.reopened - Conversation reopened

See Webhooks for configuration details.