Merges two conversations from the same visitor into a single thread.
/api/conversations/mergeMerges two conversations from the same visitor into a single thread. Messages from the newer secondary conversation are moved into the older primary conversation, and the secondary conversation is closed. This is intended for duplicate conversations created for the same visitor. Both conversation IDs must belong to the current organization and cannot point to the same conversation.
Bearer API key or X-API-Key header.conversations:writeautomation_api)application/json
Request to merge two conversations.
TypeScript Definitions
Use the request body type in TypeScript.
Request to merge two conversations.
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
{
"primaryConversationId": "11111111-1111-4111-8111-111111111111",
"mergedConversationId": "22222222-2222-4222-8222-222222222222"
}{
"error": {
"code": "string",
"message": "string",
"fields": {
"property1": "string",
"property2": "string"
},
"details": {},
"correlationId": "string"
}
}{
"error": {
"code": "string",
"message": "string",
"fields": {
"property1": "string",
"property2": "string"
},
"details": {},
"correlationId": "string"
}
}{
"error": {
"code": "string",
"message": "string",
"fields": {
"property1": "string",
"property2": "string"
},
"details": {},
"correlationId": "string"
}
}{
"error": {
"code": "string",
"message": "string",
"fields": {
"property1": "string",
"property2": "string"
},
"details": {},
"correlationId": "string"
}
}{
"error": {
"code": "string",
"message": "string",
"fields": {
"property1": "string",
"property2": "string"
},
"details": {},
"correlationId": "string"
}
}{
"error": {
"code": "string",
"message": "string",
"fields": {
"property1": "string",
"property2": "string"
},
"details": {},
"correlationId": "string"
}
}{
"error": {
"code": "string",
"message": "string",
"fields": {
"property1": "string",
"property2": "string"
},
"details": {},
"correlationId": "string"
}
}{
"error": {
"code": "string",
"message": "string",
"fields": {
"property1": "string",
"property2": "string"
},
"details": {},
"correlationId": "string"
}
}curl --request POST \
'https://api.convor.io/api/conversations/merge' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer convor_sk_...' \
--header 'Content-Type: application/json' \
--data '{
"sourceConversationId": "11111111-1111-4111-8111-111111111111",
"targetConversationId": "22222222-2222-4222-8222-222222222222"
}'const response = await fetch("https://api.convor.io/api/conversations/merge", {
method: "POST",
headers: {
"Accept": "application/json",
"Authorization": "Bearer convor_sk_...",
"Content-Type": "application/json"
},
body: JSON.stringify({
"sourceConversationId": "11111111-1111-4111-8111-111111111111",
"targetConversationId": "22222222-2222-4222-8222-222222222222"
}),
});
const contentType = response.headers.get("content-type") ?? "";
const data = response.status === 204
? null
: contentType.includes("json")
? await response.json()
: contentType.startsWith("text/")
? await response.text()
: await response.blob();
if (!response.ok) {
const message = typeof data === "object" && data !== null
&& "error" in data && typeof data.error === "object"
&& data.error !== null && "message" in data.error
? String(data.error.message)
: "Convor API request failed (" + response.status + ")";
throw new Error(message);
}
console.log(data);Was this page helpful?
Conversation that will be merged into the primary conversation. The identifier must reference a resource visible to the authenticated organization.
Conversation that will remain as the primary conversation. The identifier must reference a resource visible to the authenticated organization.