API を使用して Customer Journey を作成、変更、削除できます。フォルダー権限によって、顧客プロファイルのリストを取得したり、Journey を作成、変更、削除したりする機能に影響が出る場合があります。
- Full Control Folder Permission:ユーザーは選択したフォルダーまたは子フォルダー内のすべての Journey を作成、変更、削除できます。さらに、プロファイルと顧客のエンドポイントのリストを取得できます。
- **View Folder Permission:**ユーザーは選択したフォルダーまたは子フォルダー内の Journey を表示できます。
Journey の作成中に、セグメントやアクティベーションなどの依存リソースに名前を付けて作成する必要があります。以下の属性は、ドラフトモードの間のみエンドポイントを通じて更新できます。イタリック体で表示されたオブジェクトは、Journey の作成に必要です。属性の横にアスタリスクがある場合、属性が指定されていない場合は null {} として値を渡す必要があります。
Journey
name
description
state(draft または launched)
goal*
JourneyStages
name
description
entryCriteria
milestone
exitCriterias*
steps*
rootStep*
Journey が launch された後は、これらの属性を変更することはできません。
以下の例では、ユーザーは Journey の name、state、goal、および entry criteria、milestone、exit criteria、wait step、activation、end を含むいくつかのステージを特定しています。Journey の作成時に journey_id が指定されます。
curl -i -X POST \
https://api-cdp.treasuredata.com/entities/journeys \
-H 'AUTHORIZATION: TD1 1/1234567891234567891234000891234567891234'{
"type": "journeys",
"relationships": {
"parentFolder": {
"data": {
"id": 3456,
"type": "folder-segment"
}
},
"createdBy": {
"data": {
"id": 65,
"type": "user"
}
},
"updatedBy": {
"data": {
"id": 12,
"type": "user"
}
}
},
"attributes": {
"name": "My First Journey",
"description": "Customer participating in a journey",
"lastUpdatedAt": "... The time when last successful execution of the workflow completes ...",
"state": "launched",
"audienceId": "... Audience ID this journey belongs to ...",
"journey_stages": [
{
"name": "Awareness",
"entry_criteria": {
"name": "Visit website",
"description": "Customer visits website for the first time",
"segment_id": "78954"
},
"milestone": {
"name": "Register",
"description": "Customer signs up",
"segment_id": "98543"
},
"exit_criterias": [
{
"name": "Do not open email",
"segment_id": "94322"
},
{
"name": "Stale over 30 days",
"exitAfter": 30,
"unit": "days"
}
],
"steps": {
"a49a0aa3-6991-4dd8-a4af-c5d36fe9dd93": {
"type": "WaitStep",
"waitStep": 3,
"waitStepUnit": "day",
"next": "2b38f1e5-97d5-45ae-b165-b1c3288721cb",
},
"2b38f1e5-97d5-45ae-b165-b1c3288721cb": {
"type": "Activation",
"journeyActivationStepId": "...",
"next": "b722a160-73d3-4565-a6da-702f7019d3db"
},
"b722a160-73d3-4565-a6da-702f7019d3db": {
"type": "End"
}
},
"root_step": "a49a0aa3-6991-4dd8-a4af-c5d36fe9dd93"
}
],
"goal": {
"name": "customers that met goal",
"description": "customers met all milestones to achieve goal",
"segment_id": "54321",
}
}
}API リクエストペイロードの steps セクションを更新し、WaitStep タイプを定義することで、ステージの wait step を定義できます。たとえば、以下のペイロードサンプルの "type" の位置では、waitStep の期間と単位は 3 日間です。これは "waitStep": 3 と "waitStepUnit": "day" で示されています。
"steps": {
"a49a0aa3-6991-4dd8-a4af-c5d36fe9dd93": {
"type": "WaitStep",
"waitStep": 3,
"waitStepUnit": "day",
"next": "2b38f1e5-97d5-45ae-b165-b1c3288721cb",
}
}Journey とそのすべてのステージおよびアクティベーションを表示できます。以下の例では、Journey ID は 12345 です。
curl -i -X GET \
https://api-cdp.treasuredata.com/entities/journeys/12345 \
-H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'ドラフトモードの間、指定した Journey を更新できます。以下の例では、Journey ID は 12345 です。Journey の state が "launched" に変更された後は、属性を変更できません。UI では Journey がドラフト状態の間に exit criteria、goal、wait step を個別に追加できますが、API ではこれらの個別の呼び出しはありません。entry criteria、exit criteria、wait step、milestone、activation、goal などのリソースの値を更新するには、PATCH メソッドを使用できます。
curl -i -X PATCH \
https://api-cdp.treasuredata.com/entities/journeys/12345 \
-H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'{
"type": "journeys",
"relationships": {
"parentFolder": {
"data": {
"id": "...",
"type": "folder-segment"
}
},
"createdBy": {
"data": {
"id": "...",
"type": "user"
}
},
"updatedBy": {
"data": {
"id": "...",
"type": "user"
}
}
},
"attributes": {
"name": "My Updated Journey",
"description": "...",
"state": "launched",
"audienceId": "... Audience ID this journey belongs to ...",
"journey_stages": [
{
"name": "Awareness",
"entry_criteria": {
"name": "Visit website",
"description": "...",
"segment_id": "..."
},
"milestone": {
"name": "Register",
"description": "...",
"segment_id": "..."
},
"exit_criterias": [
{
"name": "Do not open email",
"segment_id": "..."
}
],
"steps": {
"a49a0aa3-6991-4dd8-a4af-c5d36fe9dd93": {
"type": "WaitStep",
"wait_step": 3,
"wait_step_unit": "day",
"next": "2b38f1e5-97d5-45ae-b165-b1c3288721cb",
},
"2b38f1e5-97d5-45ae-b165-b1c3288721cb": {
"type": "Activation",
"activation_id": "...",
"next": "b722a160-73d3-4565-a6da-702f7019d3db"
},
"b722a160-73d3-4565-a6da-702f7019d3db": {
"type": "End"
}
},
"root_step": "a49a0aa3-6991-4dd8-a4af-c5d36fe9dd93"
}
],
"goal": {
"name": "...",
"description": "...",
"segment_id": "...",
}
}
}指定した Journey ID を使用して Journey を削除できます。以下の例では、Journey ID は 12345 です。
curl -i -X DELETE \
https://api-cdp.treasuredata.com/entities/journeys/12345 \
-H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'