他サービスからの移行
インポートは、エージェントアプリのアプリ > 他のプラットフォームからインポート、またはAPIで開始します。 トークンにはsettings.manageと、各レコードの種類の書き込みに必要なスコープが必要です。グループとエージェントにはteam.manage、 タグにはtags.manage、定型文にはcanned.manage、顧客にはcustomers.write、 チャットにはarchives.writeとcustomers.writeが必要です。同時に実行できるインポートは1つだけです。同じインポートを 再実行しても問題ありません。インポート済みのものはスキップされ、チャットは元の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でも取得できます。
汎用フォーマット
Section titled “汎用フォーマット”上記以外の移行元からデータを移す場合は、次のいずれかの形式のファイルにまとめてください。レコードのsource_idは
お客様独自のIDで、これにより2回目の実行で同じレコードが重複してインポートされるのを防ぎます。タグは代わりに
nameで照合されます。
1つのオブジェクトに、レコードの種類ごとのリストを入れます。持っていない種類は省略してください。
{ "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です。
日時はISO 8601形式で、Zまたはオフセットを付けます(例:2026-03-02T10:15:00Z、2026-03-02T17:15:00+07:00)。
CSVのセルではUnix秒またはミリ秒も使えます。
NDJSON
Section titled “NDJSON”1行に1レコードを記述し、種類をtypeで指定します。ストリーミングで処理されるため、大きなエクスポートに適しています。
{"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?"}}]}]}レコードの種類ごとに1ファイルとし、ヘッダー行にレコードのフィールド名を並べます。種類はインポート開始時に
指定します(csv_entity)。チャット(archives)のCSVは1メッセージにつき1行で、同じチャットの行はまとめて並べます。
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?CSVとNDJSONのファイルは最大50 MB、全体を一度に読み込むJSONファイルは最大 20 MBです。
APIでインポートする
Section titled “APIでインポートする”署名付きURLにファイルをアップロードし、インポートを開始して、状態をポーリングします。
// 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で停止できます。