Clay キャンペーンへの人の登録をワークフローステップから実行します。「キャンペーンに登録」アクション(`enroll-lead-in-sequence`)を使用して行います。 次のような場合に使用: ワークフローが処理した人に対して、メール配信を開始したい場合。
Enrol Audiences people into a Clay campaign from a workflow step, using the "Enroll in campaign" action (`enroll-lead-in-sequence`). Use when a workflow should start emailing the people it just processed.
clay workflows actions list にアクション(機能)がない場合は、このワークスペースはそれを持っていません。回避策を探すのではなく、そう明確に伝えてください。
ワークフローのステップ(処理手順)として キャンペーンに登録 アクションがどのように動作するかの説明です。ワークフローの基本的な仕組み(ノード作成、入力の割り当て、$.result.* の出力パス)については、/workflows スキルとその data-passing.md を参照してください。
キャンペーンに関するその他すべて(閲覧、メール本文作成、分析、バリエーション)は clay campaigns コマンドの背後にあり、一部の製品では非表示になっています。これらの機能を提案する前に clay campaigns --help を実行し、ない場合はユーザーをキャンペーンUI(画面上の管理ツール)に案内してください。
このステップを1回実行すると、1 人の Audiences(ユーザー管理機能)ユーザーが 1 つの キャンペーンに登録されます。メール配信ではなく、登録が完了したことだけを確認します。その後のペース調整(送信タイミング)はメールプロバイダー(メール送信サービス)が管理します。
実行が成功すると、実際のメールが送信されます。 このステップを含むワークフローを公開したりテスト実行したりする前に、ユーザーからの明確な確認を得てください。
actionKey: "enroll-lead-in-sequence"actionPackageId: "b1ab3d5d-b0db-4b30-9251-3f32d8b103c1"2 つの入力パラメータがあり、まったく異なる場所から来ます:
| パラメータ | 割り当て方法 | 値の出所 |
|---|---|---|
campaignId |
static(固定値)のみ |
clay workflows actions dynamic-fields(以下参照) |
entityId |
reference(参照) |
前のステップの Audiences ユーザーレコード ID(以下参照) |
出力はすべて $.result の下にあります:enrollmentStatus(「enrolled」または「already_enrolled」のいずれか。どちらも成功)、campaignId、entityId、email、entityResolution(「provided」「matched」「created」のいずれか)。最初の 4 つだけが出力パラメータとして宣言されているため、entityResolution は実行結果には含まれていますが、clay workflows actions schema やトークンピッカー(値選択画面)には現れません。
campaignId は固定値である必要がありますキャンペーンは固定的な選択であり、実行ごとに変わるデータではありません。reference、item、llm、map 割り当てはすべて 拒否 され、inputMappingConfig key "campaignId" must be a static value(キャンペーン ID は固定値である必要があります)というエラーが出ます。先に実際の ID を確認してください:
clay workflows actions dynamic-fields b1ab3d5d-b0db-4b30-9251-3f32d8b103c1 \
enroll-lead-in-sequence campaignId --type select
このコマンドは アクティブ で、ワークフローからユーザーを受け取るキャンペーンだけを返すため、その出力がこの値の唯一の安全な情報源です。clay campaigns list から ID を選ばないでください。そこにあるほとんどのキャンペーンはオーディエンス(ユーザーグループ)からユーザーを取得しており、このステップでそれを指定すると毎回 campaign_not_workflow エラーで失敗します。
次の 2 つの結果はブロッキング(処理停止)で、再試行不可です。ユーザーに報告してください:
Couldn't load campaigns. Try again.(キャンペーンを読み込めませんでした)— 検索自体が失敗しました。No live campaigns take their leads from a workflow. Launch one to enroll.(ワークフロー出発のキャンペーンがありません)— ワークスペースに対象のキャンペーンがなく、キャンペーンUI で新しいものを立ち上げるまでこのステップは設定できません。どのスキルも立ち上げはできません。ユーザーが UI で実行する必要があります。entityId は Audiences レコード ID ですサポートされている 3 つの取得方法があり、それぞれが異なる質問に答えます。
実行ごと(通常のケース):前のステップの Audiences から取得する
upsert-audiences-record と update-audiences-record はどちらも操作したレコードを entityId として返すため、このステップの前にどちらかを置き、その出力を接続します。/workflows の audiences.md に upsert(更新または挿入)の設定方法が説明されています。
{
"inputSchema": {
"type": "object",
"properties": {
"record_id": {
"type": "string",
"sourceNodeId": "wfn_upsert",
"sourcePath": "$.result.entityId"
}
}
},
"tools": [
{
"toolType": "clay_action",
"actionKey": "enroll-lead-in-sequence",
"actionPackageId": "b1ab3d5d-b0db-4b30-9251-3f32d8b103c1",
"inputMappingConfig": {
"campaignId": { "type": "static", "value": "<id from dynamic-fields>" },
"entityId": { "type": "reference", "expression": "{{record_id}}" }
}
}
]
}
sourcePath は $.result.entityId である必要があります。$.result だけだと出力オブジェクト全体が渡され、invalid_input エラーで失敗します。エンリッチステップ(追加情報を付与する処理)の出力は /workflows の data-passing.md に従い、result の下にあります。
レコードを作成する代わりに検索する場合
Audiences での検索(lookup-in-audiences)も ID を持っており、$.result.records[0].fields.id にあります。ユーザーが既に Audiences にいて、ワークフローがユーザーに書き込む理由がない場合に使用します。upsert ルートとの 3 つの違いがあり、すべて注意が必要です:
clay workflows actions schema は空の outputParameters を返し、フィールドレベルのトークンはありません。アクションを 1 回実行し、.result からパスを読み取って接続してください。/workflows の data-passing.md を参照。limit で上限あり)ため、records[0] にインデックスを付ける必要があります。検索が何もマッチしない場合は空の配列を返し、登録ステップは invalid_input で失敗します。固定レコード(テスト、または常に同じ人を対象とするワークフロー):
clay audiences records search-ids --entity-type people … で一致する ID を取得し、1 つを static 値として割り当てます。処理したばかりの人を登録することが目的なワークフローではこれは不適切です。
同じ前のステップの upsert で作成されたコンタクトとアカウントはまだこのステップが読める方法でリンクされていないため、本文の企業トークンはその最初の登録では空白でレンダリングされます。本文がそれに依存する場合は、前のステップで アカウントをエンリッチまたは関連付けてください。
すべてのエラーにはこれらのコードのいずれかが付き、それに伴うメッセージはそのままユーザーに伝えても安全です。これがすべてのセットです。これ以外のコードは登録が試行される前にステップが失敗したことを意味します。
| コード | 意味 |
|---|---|
contact_not_found |
レコードが存在しない、別のワークスペースに属している、または削除されている |
ambiguous_identity |
レコードを単一の人物に解決できなかった |
canonical_email_mismatch |
レコードに使用可能なメールアドレスがない |
missing_required_fields |
キャンペーンメール本文が要求するデータがレコードにない |
campaign_not_active |
キャンペーンがアクティブでない |
campaign_not_workflow |
そのキャンペーンはワークフローではなくオーディエンスからユーザーを取得する |
campaign_not_found |
キャンペーンが存在しない |
lead_in_cooldown |
関連するキャンペーンへの登録が最近実行された |
cooldown_check_unavailable |
クールダウン(待機期間)チェックができなかった |
insufficient_credits |
この登録用のクレジット(使用額度)が不足している |
snippet_generation_failed |
キャンペーンの AI スニペット(自動生成テキスト)が生成できなかった |
provider_rejected |
メールプロバイダーがこのユーザーを拒否した(ブロックリスト、購読解除) |
invalid_input |
通常は ID ではなくオブジェクトを渡した sourcePath |
feature_disabled |
このワークスペースではワークフロー出発の登録がオフである |
provider_result_indeterminate |
プロバイダーの答えが確認できなかった |
enrollment_persistence_unavailable |
登録結果を記録できなかった |
unexpected_error |
未処理の エラー |
provider_result_indeterminate と enrollment_persistence_unavailable はそのユーザーが 既に登録されている可能性がある ことを意味します。ステップを再実行するとメールが 2 通送信される可能性があるため、ユーザーに報告し、再試行するのではなくキャンペーンを確認させてください。
clay campaigns variants send-test はワークフロー出発のキャンペーンをプレビューできません。オーディエンスのプレビュー用ユーザーを探すためです。これらのキャンペーンにはそれがありません。本文のテストレンダリングを送信できるのは、現在のところアプリのステップパネル(画面内の操作パネル)からのみです。本文を確認するために実際の登録を送信しないで、そう説明してください。
If the action is absent from clay workflows actions list, this workspace does not have it — say so
rather than trying to work around it.
How the Enroll in campaign action works as a workflow step. For the workflow mechanics this
builds on (node creation, input mapping, $.result.* output paths), use the /workflows skill
and its data-passing.md.
Everything else about campaigns — reading them, writing sequence copy, analytics, variants — lives
behind clay campaigns, which is hidden in some products. Run clay campaigns --help before
offering any of it, and point the user at the Campaigns UI when it is absent.
One run of this step enrols one Audiences person into one campaign. It confirms enrollment, not delivery: the email provider owns pacing from there.
A successful run sends a real email. Get the user's explicit confirmation before publishing or test-running a workflow that contains this step.
actionKey: "enroll-lead-in-sequence"actionPackageId: "b1ab3d5d-b0db-4b30-9251-3f32d8b103c1"Two inputs, and they come from completely different places:
| Parameter | Mapping | Where the value comes from |
|---|---|---|
campaignId |
static only |
clay workflows actions dynamic-fields (below) |
entityId |
reference |
an upstream Audiences step's record id (below) |
Outputs, all under $.result: enrollmentStatus ("enrolled" or "already_enrolled" — both are
successes), campaignId, entityId, email, and entityResolution ("provided", "matched",
or "created"). Only the first four are declared output parameters, so entityResolution is in
the run result but never in clay workflows actions schema or a token picker.
campaignId must be a static valueThe campaign is a fixed choice, not per-run data. A reference, item, llm, or map mapping
is rejected with inputMappingConfig key "campaignId" must be a static value. Resolve a real
id first:
clay workflows actions dynamic-fields b1ab3d5d-b0db-4b30-9251-3f32d8b103c1 \
enroll-lead-in-sequence campaignId --type select
That returns only campaigns that are active and take their leads from a workflow, so its
output is the only safe source for this value. Do not pick an id out of clay campaigns list:
most campaigns there draw leads from an audience instead, and pointing this step at one fails
every run with campaign_not_workflow.
Two outcomes are blocking, not retryable — report them to the user rather than trying again:
Couldn't load campaigns. Try again. — the lookup itself failed.No live campaigns take their leads from a workflow. Launch one to enroll. — the workspace has
no eligible campaign, and this step cannot be configured at all until it does. Launching is not
something any skill can do; the user has to do it in the Campaigns UI.entityId is an Audiences record idThere are three supported ways to get one, and they answer different questions.
Per-run (the normal case): take it from an upstream Audiences step. Both
upsert-audiences-record and update-audiences-record return the record they touched as
entityId, so put one of them ahead of this step and wire its output through. /workflows's
audiences.md covers configuring the upsert itself.
{
"inputSchema": {
"type": "object",
"properties": {
"record_id": {
"type": "string",
"sourceNodeId": "wfn_upsert",
"sourcePath": "$.result.entityId"
}
}
},
"tools": [
{
"toolType": "clay_action",
"actionKey": "enroll-lead-in-sequence",
"actionPackageId": "b1ab3d5d-b0db-4b30-9251-3f32d8b103c1",
"inputMappingConfig": {
"campaignId": { "type": "static", "value": "<id from dynamic-fields>" },
"entityId": { "type": "reference", "expression": "{{record_id}}" }
}
}
]
}
sourcePath must be $.result.entityId. $.result on its own passes the whole output object and
fails with invalid_input — an enrich step's outputs sit under result, per /workflows's
data-passing.md.
Looking a record up instead of writing one. Look up in Audiences (lookup-in-audiences)
also carries the id, at $.result.records[0].fields.id. Use it when the person is already in
Audiences and the workflow has no reason to write to them. Three differences from the upsert route,
all of which bite:
clay workflows actions schema returns an empty
outputParameters and there is no field-level token to pick. Run the action once and read the
path off .result before wiring it — see /workflows's data-passing.md.limit, so you must index records[0]. A lookup that matches
nothing returns an empty array, and the enrol step then fails invalid_input.A fixed record (testing, or a workflow that always targets the same person):
clay audiences records search-ids --entity-type people … returns matching ids; map one as a
static value. This is wrong for a workflow meant to enrol whoever it just processed.
A contact and an account created by the same upstream upsert are not yet linked in a way this step can read, so company tokens in the copy render blank on that first enrollment. Enrich or associate the account in an earlier run if the copy depends on it.
Every failure carries one of these codes, and the message alongside it is safe to relay verbatim. This is the whole set — a code outside it means the step failed before enrollment was attempted.
| Code | Means |
|---|---|
contact_not_found |
no such record, or it belongs to another workspace / is deleted |
ambiguous_identity |
the record could not be resolved to a single person |
canonical_email_mismatch |
the record has no usable email address |
missing_required_fields |
the record is missing data the campaign copy requires |
campaign_not_active |
the campaign is not active |
campaign_not_workflow |
that campaign takes its leads from an audience, not a workflow |
campaign_not_found |
the campaign no longer exists |
lead_in_cooldown |
enrolled in a related campaign too recently |
cooldown_check_unavailable |
the cooldown could not be checked |
insufficient_credits |
the workspace is out of credits for this enrollment |
snippet_generation_failed |
the campaign's AI snippets could not be generated |
provider_rejected |
the email provider refused this person (blocklist, unsubscribe) |
invalid_input |
usually a sourcePath that passed an object instead of the id |
feature_disabled |
enrollment from workflows is off for this workspace |
provider_result_indeterminate |
the provider's answer could not be confirmed |
enrollment_persistence_unavailable |
the enrollment result could not be recorded |
unexpected_error |
an unhandled failure |
provider_result_indeterminate and enrollment_persistence_unavailable mean the person may
already be enrolled. Re-running the step can send a second email, so report them and let the user
check the campaign rather than retrying.
clay campaigns variants send-test cannot preview a workflow-fed campaign — it looks for a
preview lead in an audience, and these campaigns have none. Sending a test render of the copy is
only possible from the step's own panel in the app today. Say so rather than sending a real
enrollment to check the copy.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。