콘텐츠로 이동

채팅과 고객 데이터 가져오기

가져오기는 에이전트 앱의 앱 > 다른 플랫폼에서 가져오기에서 시작하거나 API로 시작할 수 있습니다. 토큰에는 settings.manage와 함께 각 레코드 유형을 쓰는 데 필요한 범위가 있어야 합니다. 그룹과 상담원은 team.manage, 태그는 tags.manage, 상용 문구는 canned.manage, 고객은 customers.write, 채팅은 archives.write와 customers.write가 필요합니다. 가져오기는 한 번에 하나만 실행됩니다. 같은 가져오기를 다시 실행해도 안전합니다. 이미 가져온 데이터는 건너뛰며, 채팅은 원래 ID와 시간을 그대로 유지합니다. 비밀번호는 기존 플랫폼 밖으로 나오지 않으므로 상담원은 초대 형태로 추가됩니다.

원본방식가져오는 항목
LiveChat해당 플랫폼의 API(내 토큰 사용)groups, agents, tags, canned responses, customers, archives
Intercom해당 플랫폼의 API(내 토큰 사용)groups, agents, tags, customers, archives
Crisp해당 플랫폼의 API(내 토큰 사용)agents, customers, archives
Zendesk Chat해당 플랫폼의 API(내 토큰 사용)groups, agents, canned responses, archives
tawk.to내보내기 파일(json, csv)customers, archives
Tidio내보내기 파일(csv, json)customers, archives
Olark내보내기 파일(csv, json)customers, archives
CSV or JSON file내보내기 파일(json, ndjson, csv)groups, agents, tags, canned responses, customers, archives

API 소스의 경우 가져오기 양식에서 필요한 인증 정보와 그 정보를 찾는 위치를 안내합니다. 인증 정보는 가져오기가 끝날 때까지 암호화되어 보관됩니다. GET /v1/imports/sources로도 같은 목록을 확인할 수 있습니다.

다른 곳에서 가져오는 데이터라면 아래 파일 형식 중 하나로 정리하세요. 레코드의 source_id는 직접 지정하는 ID로, 두 번째로 실행할 때 같은 레코드를 중복으로 가져오지 않게 해 줍니다. 단, 태그는 name으로 일치 여부를 판단합니다.

레코드 유형별 목록을 담은 객체 하나입니다. 없는 유형은 생략하세요.

import.json
{
"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." } }
]
}
]
}
]
}

필수 필드는 굵게 표시했으며, 나머지는 모두 생략할 수 있습니다.

  • groups: source_id, name.
  • agents: source_id, email, name, role(admin 또는 agent), group_source_ids.
  • tags: name, color(#rrggbb 형식).
  • canned_responses: source_id, text, shortcuts, group_source_id.
  • customers: source_id, name, email, phone, external_user_id(자체 사용자 ID), session_fields(이름과 값의 쌍), first_seen_at, last_seen_at.
  • archives: source_id, customer, threads(최소 1개)로 이루어진 채팅입니다. 스레드에는 source_id, created_at, events와 함께 closed_at, tags, rating(good 또는 bad), group_source_id가 있습니다. 이벤트에는 created_at, author(type은 customer, agent, system 중 하나), body와 함께 source_id, visibility(내부 메모는 agents)가 있습니다. 본문의 type은 text가 있는 message, url과 name이 있는 file, form_kind와 answers가 있는 filled_form, text가 있는 system, 또는 custom입니다.

시간은 Z 또는 오프셋을 포함한 ISO 8601 형식입니다(예: 2026-03-02T10:15:00Z, 2026-03-02T17:15:00+07:00). CSV 셀에는 Unix 초나 밀리초도 쓸 수 있습니다.

한 줄에 레코드 하나를 쓰고, 레코드 유형은 type에 지정합니다. 스트리밍으로 처리되므로 대용량 내보내기에 적합합니다.

import.ndjson
{"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?"}}]}]}

레코드 유형마다 파일 하나를 사용합니다. 헤더에는 레코드의 필드 이름을 쓰고, 유형은 가져오기를 시작할 때 지정합니다 (csv_entity). archives CSV는 메시지 하나당 한 행이며, 같은 채팅의 행은 연속해서 배치합니다.

archives.csv
chat_id,thread_id,created_at,author_type,author_name,author_email,text
chat-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?

CSV 또는 NDJSON 파일은 최대 50 MB, 전체를 한 번에 읽는 JSON 파일은 최대 20 MB까지 가져올 수 있습니다.

서명된 URL에 파일을 업로드하고, 가져오기를 시작한 다음, 상태를 폴링하세요.

import-file.mjs
// 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 }));

실패하거나 취소된 가져오기는 POST /v1/imports/{id}:resume으로 중단된 지점부터 다시 시작할 수 있으며, 실행 중인 가져오기는 POST /v1/imports/{id}:cancel로 중지할 수 있습니다.