Import chats and contacts from elsewhere
Start an import in the agent app under Apps > Import from another platform, or with the API. A token needs settings.manage, and the scope each record type writes: team.manage for groups and agents, tags.manage for tags, canned.manage for canned responses, customers.write for customers, and archives.write with customers.write for chats. One import runs at a time. Running the same import again is safe: what was already imported is skipped, and chats keep their original ids and times. Agents arrive as invitations, since passwords never leave the other platform.
Sources
Section titled “Sources”| From | How | What comes across |
|---|---|---|
| LiveChat | Its API, with your token | groups, agents, tags, canned responses, customers, archives |
| Intercom | Its API, with your token | groups, agents, tags, customers, archives |
| Crisp | Its API, with your token | agents, customers, archives |
| Zendesk Chat | Its API, with your token | groups, agents, canned responses, archives |
| tawk.to | An export file (json, csv) | customers, archives |
| Tidio | An export file (csv, json) | customers, archives |
| Olark | An export file (csv, json) | customers, archives |
| CSV or JSON file | An export file (json, ndjson, csv) | groups, agents, tags, canned responses, customers, archives |
For an API source the import form asks for the credentials it needs and says where to find them;
they are held encrypted until the import ends. GET /v1/imports/sources lists the same.
Generic format
Section titled “Generic format”When your data comes from anywhere else, put it in one of these files. A record’s source_id is
your own id for it, which is what keeps a second run from importing it twice; tags are matched by
name instead.
One object, a list per record type. Leave out the types you do not have:
{ "groups": [{ "source_id": "g-sales", "name": "Sales" }], "agents": [{ "source_id": "a-1", "email": "maria@example.com", "name": "Maria Lopez", "role": "agent", "group_source_ids": ["g-sales"] }], "tags": [{ "name": "refund", "color": "#e5484d" }], "canned_responses": [{ "source_id": "c-1", "text": "Thanks for reaching out! How can I help?", "shortcuts": ["hi"], "group_source_id": null }], "customers": [{ "source_id": "u-1", "name": "Ana Silva", "email": "ana@example.com", "phone": null, "external_user_id": "user-1001", "session_fields": [["plan", "pro"]] }], "archives": [ { "source_id": "chat-1", "customer": { "source_id": "u-1", "name": "Ana Silva", "email": "ana@example.com" }, "threads": [ { "source_id": "thread-1", "created_at": "2026-03-02T10:15:00Z", "closed_at": "2026-03-02T10:21:00Z", "tags": ["refund"], "rating": "good", "group_source_id": "g-sales", "events": [ { "source_id": "e-1", "created_at": "2026-03-02T10:15:00Z", "author": { "type": "customer", "source_id": "u-1", "name": "Ana Silva" }, "body": { "type": "message", "text": "Hi, can I get a refund for order 1001?" } }, { "source_id": "e-2", "created_at": "2026-03-02T10:16:30Z", "author": { "type": "agent", "source_id": "a-1", "name": "Maria Lopez", "email": "maria@example.com" }, "body": { "type": "message", "text": "Of course. I have started it, you will see it in 3 to 5 days." } }, { "source_id": "e-3", "created_at": "2026-03-02T10:17:00Z", "author": { "type": "agent", "source_id": "a-1", "name": "Maria Lopez" }, "visibility": "agents", "body": { "type": "message", "text": "Refund approved under the 30-day policy." } } ] } ] } ]}Required fields are in bold; everything else may be left out.
- groups:
source_id,name. - agents:
source_id,email,name,role(adminoragent),group_source_ids. - tags:
name,coloras#rrggbb. - canned_responses:
source_id,text,shortcuts,group_source_id. - customers:
source_id,name,email,phone,external_user_id(your own user id),session_fieldsas name and value pairs,first_seen_at,last_seen_at. - archives: a chat with
source_id, itscustomer, andthreads(at least one). A thread hassource_id,created_at,events, andclosed_at,tags,rating(goodorbad) andgroup_source_id. An event hascreated_at, anauthor(itstypeiscustomer,agentorsystem), abody, andsource_idandvisibility(agentsfor an internal note). The body’stypeismessagewithtext,filewithurlandname,filled_formwithform_kindandanswers,systemwithtext, orcustom.
Times are ISO 8601 with Z or an offset, such as 2026-03-02T10:15:00Z or 2026-03-02T17:15:00+07:00;
a CSV cell also takes Unix seconds or milliseconds.
NDJSON
Section titled “NDJSON”One record per line, its type in type. Use it for a large export: it streams.
{"type": "groups", "source_id": "g-sales", "name": "Sales"}{"type": "tags", "name": "refund", "color": "#e5484d"}{"type": "customers", "source_id": "u-1", "name": "Ana Silva", "email": "ana@example.com"}{"type": "archives", "source_id": "chat-1", "customer": {"source_id": "u-1", "name": "Ana Silva"}, "threads": [{"source_id": "thread-1", "created_at": "2026-03-02T10:15:00Z", "events": [{"created_at": "2026-03-02T10:15:00Z", "author": {"type": "customer", "source_id": "u-1"}, "body": {"type": "message", "text": "Hi, can I get a refund for order 1001?"}}]}]}One file per record type, its header naming the record’s fields, and the type given when the
import starts (csv_entity). An archives CSV has one row per message, the rows of one chat
together:
chat_id,thread_id,created_at,author_type,author_name,author_email,textchat-1,thread-1,2026-03-02T10:15:00Z,customer,Ana Silva,ana@example.com,"Hi, can I get a refund for order 1001?"chat-1,thread-1,2026-03-02T10:16:30Z,agent,Maria Lopez,maria@example.com,"Of course. I have started it, you will see it in 3 to 5 days."chat-2,thread-2,2026-03-03T08:02:00Z,customer,Joe Park,joe@example.com,Do you ship to Canada?A CSV or NDJSON file may be up to 50 MB; a JSON file, read whole, up to 20 MB.
With the API
Section titled “With the API”Upload the file to a signed URL, start the import, and poll it:
// Import an export file in the generic format, then wait for the import to finish. Node 18 or later.// Usage: node import-file.mjs import-generic.json (a CSV also needs its entity: archives.csv archives)import { readFile } from "node:fs/promises";import { basename } from "node:path";
const api = process.env.C2R_API || "https://api.click2reply.com";const auth = { authorization: `Bearer ${process.env.C2R_TOKEN}` };const [path, csvEntity] = process.argv.slice(2);
async function call(route, body) { const res = await fetch(`${api}${route}`, body === undefined ? { headers: auth } : { method: "POST", headers: { ...auth, "content-type": "application/json" }, body: JSON.stringify(body) }); const json = await res.json(); if (!res.ok) throw new Error(`${res.status} ${json.error.code}: ${json.error.message}`); return json;}
// 1. A signed URL to upload the file to, then the upload itself.const file = await readFile(path);const ticket = await call("/v1/imports:upload_url", { name: basename(path), size: file.length });const put = await fetch(ticket.upload_url, { method: "PUT", body: file });if (!put.ok) throw new Error(`upload answered ${put.status}`);
// 2. Start the import. Leave out options.include to import every record type the file holds.let job = await call("/v1/imports", { source: "generic", file_key: ticket.file_key, options: { csv_entity: csvEntity ?? null } });
// 3. Poll until it ends; progress counts what each step imported, skipped and failed.while (job.status === "queued" || job.status === "running") { await new Promise((r) => setTimeout(r, 3000)); job = await call(`/v1/imports/${job.id}`);}console.log(JSON.stringify({ id: job.id, status: job.status, error_code: job.error_code, progress: job.progress }));An import that failed or was cancelled resumes where it stopped with
POST /v1/imports/{id}:resume; POST /v1/imports/{id}:cancel stops one that is running.