オートメーション
連絡先ごとに自動で実行されるメールとステップ、そしてそれを開始するイベント。
オートメーションのツール
| ツール | 機能 |
|---|---|
| listAutomations | ワークスペースのオートメーションを、最近変更されたものから順に返します。それぞれのステータス、開始条件、参加中の連絡先の数が付きます。 |
| getAutomation | オートメーション 1 件の全体です。ステータス、設定、数値、下書きの問題点、JSON 形式の下書きの定義を返します。includePublished を指定すると、実行中のバージョンが加わります。 |
| listAutomationStarters | 新しいオートメーションの出発点にできる既製のオートメーション。それぞれに定義が付いています。 |
| createAutomation | ひな形から、JSON で書いた定義から、または空の状態で、任意の設定とともに下書きを作成します。公開するまで何も実行されません。 |
| updateAutomation | オートメーションの名前と設定を変更するか、下書きの定義を置き換えます。名前と設定はすぐに反映されます。公開中のオートメーションは、公開済みのバージョンを実行し続けます。 |
| deleteAutomation | オートメーションを、そのバージョン、参加状況、数値とともに完全に削除します。参加中の連絡先はすぐに止まります。 |
| publishAutomation | 下書きを実行されるバージョンにし、オートメーションを有効にします。未完成の下書きは、公開を妨げるすべての問題とともに拒否されます。emails:send も必要です。 |
| pauseAutomation | 公開中のオートメーションを止めます。新しく入る人はなく、参加中の人は全員その場にとどまります。 |
| resumeAutomation | 一時停止中のオートメーションを、実行していたバージョンのまま再び有効にします。emails:send も必要です。 |
| archiveAutomation | オートメーションを完全に終了し、履歴は残します。参加中の人は全員退出します。 |
| duplicateAutomation | バージョン、連絡先、数値は含めずに、オートメーションを新しい下書きにコピーします。 |
| sendAutomationTest | 下書きの 1 つのステップのメールを、自分宛てまたは 1 つのアドレス宛てに送信します。emails:send も必要です。 |
| listAutomationVersions | 公開されたバージョンを新しい順に返し、どれが実行中かも示します。includeDefinitions を指定すると各バージョンの定義が加わります。 |
| restoreAutomationVersion | 以前のバージョンを下書きにコピーし直します。次に公開するまで、実行中のものは何も変わりません。 |
| getAutomationStats | 期間内に入った連絡先、現在参加中の連絡先、完了した連絡先、退出した連絡先の数と、送信、配信、開封、クリックされたメールの数を、合計とステップごとに返します。 |
| listAutomationEnrollments | オートメーションに参加中の連絡先と、過去に参加した連絡先を 1 ページずつ返します。それぞれが今いるステップと、終了のしかたが付きます。ステータス、ステップ、アドレスの一部で絞り込めます。 |
| getAutomationEnrollment | 連絡先 1 件がオートメーションをたどった経過です。各ステップがその連絡先に何をしたかを古い順に示します。 |
| enrollInAutomation | 通常の開始条件にかかわらず、連絡先 1 件を公開中のオートメーションの最初のステップに入れます。 |
| removeFromAutomation | 連絡先 1 件を、すぐにオートメーションから外します。 |
| sendContactEvent | 連絡先に何かが起きたことを記録します。トリガーでそのイベントを指定している公開中のオートメーションを開始し、そのイベントを待っていた待機を終了します。 |
| sendContactEvents | 1 回の呼び出しで最大 100 件のイベントを記録します。1 件が失敗しても残りは止まりません。 |
| listContactEventNames | ワークスペースが過去 90 日間に記録したイベント名です。 |
| listContactEvents | 連絡先 1 件に記録されたイベントを新しい順に、1 ページずつ。 |
読み取りには automations:read、すべての変更には automations:write が必要です。公開、再開、テスト送信には emails:send も必要です。そのあとオートメーションは、公開した人に代わってメールを送信するためです。イベントの送信には contacts:write、連絡先のイベントの読み取りには contacts:read、listContactEventNames には automations:read が必要です。メンバーの代理として動作するクライアントに見えるのは、そのメンバーが作成したオートメーションと、そのメンバーが追加した連絡先だけです。
このサーバーの一部のツールは、REST API が確認コードで保護している変更を行うため、同じコードを求めます。クライアントが直近 60 分以内にコードを確認しておらず、本人がアカウント → 接続済みアプリでそのクライアントに「60分間、変更を許可」を選んでもいない間、これらのツールは Refused (step_up_required): で始まる結果を返し、何も変更しません。emptyAudience がコードを求めることはありません。コードを求めるツールの一覧と、コードの要求と確認の方法は API の認証ページにあります。
ツールには REST API と同じルールと拒否が適用され、API リファレンスの /automations と /events のページがすべてのフィールドを説明しています。定義は JSON として丸ごと渡します。getAutomation で読み取り、変更して、全体を updateAutomation に渡してください。
リファレンス
listAutomationsgetAutomationlistAutomationStarterscreateAutomationupdateAutomationdeleteAutomationpublishAutomationpauseAutomationresumeAutomationarchiveAutomationduplicateAutomationsendAutomationTestlistAutomationVersionsrestoreAutomationVersiongetAutomationStatslistAutomationEnrollmentsgetAutomationEnrollmentenrollInAutomationremoveFromAutomationsendContactEventsendContactEventslistContactEventNameslistContactEvents
listAutomations
List the automations in this workspace, the most recently changed first: name, id, status (draft, live, paused or archived), what starts each one, its steps and how many contacts are in it now, completed it or left early. Use it to find an automation by name before reading or changing it. One page at a time: when more follow, the last line gives a cursor to pass back.
入力
statusstring- 次のいずれか
"draft""live""paused""archived" limitinteger- 1以上100以下
cursorstring- 1〜64文字
ほかの提供先
- API
GET /automations- TypeScript
automations.list()automations.listAll()automations.iterate()- Python
automations.list()automations.list_all()automations.iterate()- Ruby
automations.listautomations.list_allautomations.iterate- PHP
automations->listautomations->listAllautomations->iterate- Go
Automations.ListAutomations.ListAllAutomations.Iterate- Java
automations().listautomations().listAllautomations().iterate- C#
Automations.ListAsyncAutomations.ListAllAsyncAutomations.IterateAsync
getAutomation
Read one automation: its status, settings, numbers, what is wrong with its draft, and the draft definition (trigger and steps) as JSON, to change and pass back to updateAutomation. includePublished adds the definition of the version that is running, which differs from the draft while there are unpublished changes.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字includePublishedboolean- 既定値
false
ほかの提供先
listAutomationStarters
The ready-made automations a new one can begin from, such as a welcome series or a birthday note: slug, name, what each is for and its definition as JSON. Pass a slug to createAutomation as starter. A starter leaves the audience, the templates and the from address empty to fill in.
入力
入力はありません。
ほかの提供先
createAutomation
Create an automation as a draft: from a starter (listAutomationStarters names them), from a definition written out as JSON, or empty. Nothing runs until publishAutomation. The answer lists what the draft still needs before it can be published, such as a template or a from address for each email. Find audiences with listAudiences, templates with listTemplates and forms with listForms.
入力
namestring必須A short name for the automation. Contacts never see it.
1〜120文字descriptionstringOne line about what it is for.
500文字までstarterstring- 1〜64文字
definitionRecord<string, any> | stringThe trigger and steps as JSON: {"trigger": {...}, "entry": "<key of the first step>", "steps": [...]}. Triggers: {"kind": "audience_joined", "audienceId", "includeImported": false}, {"kind": "form_submitted", "formId"}, {"kind": "event", "eventName", "filters": []}, {"kind": "date", "field": "birthday" or "joined", "audienceId", "offsetDays": 0} and {"kind": "manual"}. Every step has a unique key of 3 to 24 lowercase letters and digits starting with a letter, and points at the next step by key in next, or null to end the path. Steps: {"kind": "send_email", "key", "next", "templateId", "templateVersion": null, "from": {"email", "name"}, "replyTo": null, "subject": null, "props": {}}, {"kind": "wait", "key", "next", "wait": {"mode": "duration", "amount": 3, "unit": "days"}}, {"kind": "branch", "key", "condition": {"kind": "email_clicked", "stepKey"}, "yes", "no"}, {"kind": "add_to_audience" or "remove_from_audience", "key", "next", "audienceId"}, {"kind": "update_field", "key", "next", "field", "value": {"source": "static", "value"}}, {"kind": "webhook", "key", "next", "endpointId"} and {"kind": "exit", "key"}. A wait can also be {"mode": "until", "weekdays": [1], "hour": 9, "minute": 0} or {"mode": "event", "eventName", "timeout": {"amount": 7, "unit": "days"}}. Conditions: email_opened and email_clicked with stepKey, in_audience with audienceId, field with field, operator and value, and event with eventName and withinDays. A props value is {"source": "static", "value"}, {"source": "contact", "field"} or {"source": "event", "path"}. Paths never join or loop. getAutomation shows a saved definition in this shape, and listAutomationStarters has ready-made ones.
settingsRecord<string, any> | stringHow it runs, as JSON with any of: timezone (an IANA zone such as Europe/London), sendWindow ({"days": [1, 2, 3, 4, 5], "startMinute": 540, "endMinute": 1020} or null for any time), reentryDays (days after finishing before a contact may enter again, or null for once only), exitOnLeave (true takes a contact out when they leave the audience that started it) and listAudienceId (the audience unsubscribes are recorded in).
ほかの提供先
updateAutomation
Change an automation. Its name, description and settings apply at once. definition replaces the whole draft, so start from getAutomation, change the JSON and pass all of it back. A live automation keeps running its published version until publishAutomation, and contacts already in it stay on the version they entered on. Pass only what changes.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字namestring- 1〜120文字
descriptionstring- null も可500文字まで
definitionRecord<string, any> | stringThe trigger and steps as JSON: {"trigger": {...}, "entry": "<key of the first step>", "steps": [...]}. Triggers: {"kind": "audience_joined", "audienceId", "includeImported": false}, {"kind": "form_submitted", "formId"}, {"kind": "event", "eventName", "filters": []}, {"kind": "date", "field": "birthday" or "joined", "audienceId", "offsetDays": 0} and {"kind": "manual"}. Every step has a unique key of 3 to 24 lowercase letters and digits starting with a letter, and points at the next step by key in next, or null to end the path. Steps: {"kind": "send_email", "key", "next", "templateId", "templateVersion": null, "from": {"email", "name"}, "replyTo": null, "subject": null, "props": {}}, {"kind": "wait", "key", "next", "wait": {"mode": "duration", "amount": 3, "unit": "days"}}, {"kind": "branch", "key", "condition": {"kind": "email_clicked", "stepKey"}, "yes", "no"}, {"kind": "add_to_audience" or "remove_from_audience", "key", "next", "audienceId"}, {"kind": "update_field", "key", "next", "field", "value": {"source": "static", "value"}}, {"kind": "webhook", "key", "next", "endpointId"} and {"kind": "exit", "key"}. A wait can also be {"mode": "until", "weekdays": [1], "hour": 9, "minute": 0} or {"mode": "event", "eventName", "timeout": {"amount": 7, "unit": "days"}}. Conditions: email_opened and email_clicked with stepKey, in_audience with audienceId, field with field, operator and value, and event with eventName and withinDays. A props value is {"source": "static", "value"}, {"source": "contact", "field"} or {"source": "event", "path"}. Paths never join or loop. getAutomation shows a saved definition in this shape, and listAutomationStarters has ready-made ones.
settingsRecord<string, any> | stringHow it runs, as JSON with any of: timezone (an IANA zone such as Europe/London), sendWindow ({"days": [1, 2, 3, 4, 5], "startMinute": 540, "endMinute": 1020} or null for any time), reentryDays (days after finishing before a contact may enter again, or null for once only), exitOnLeave (true takes a contact out when they leave the audience that started it) and listAudienceId (the audience unsubscribes are recorded in).
expectedUpdatedAtstringThe Updated time getAutomation gave. When somebody saved the automation since, the change is refused instead of written over theirs.
形式date-time
ほかの提供先
deleteAutomation
Delete an automation for good, with its versions, its enrollments and its numbers. Contacts in it stop at once. The emails it already sent stay. It cannot be undone: to retire one and keep its history, use archiveAutomation.
- 確認コードが必要
DELETE /automations/{id}
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字
ほかの提供先
publishAutomation
Publish an automation: its draft becomes the version that runs and it goes live, so its trigger starts putting contacts in and its emails start going out. Use it for a first publish and to put later changes to work. The draft has to be complete, and a refusal lists every problem that blocks it. Contacts already in it stay on the version they entered on.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字
ほかの提供先
pauseAutomation
Pause a live automation. Nobody new enters, and everyone in it stays where they are and moves on when it is resumed with resumeAutomation.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字
ほかの提供先
resumeAutomation
Turn a paused automation back on with the version it was running, without publishing the draft. Contacts that were held move on and its emails go out again. One that was paused because something it needs went away stays paused until that is fixed, and the refusal says what.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字
ほかの提供先
archiveAutomation
Retire an automation for good and keep its history. Everyone in it leaves, nobody enters again and it can no longer be changed, published or resumed. Its versions, enrollments and numbers stay readable. To stop one for a while, use pauseAutomation.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字
ほかの提供先
duplicateAutomation
Copy an automation into a new draft with "(copy)" after its name: the same draft definition and settings, and none of its versions, contacts or numbers.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字
ほかの提供先
sendAutomationTest
Send the email of one step of the draft to one address, to read it before publishing. It goes to the user's own account address unless to names another. Contact values come from a sample contact, the subject starts with [Test], and nobody is enrolled. It counts toward the monthly sends.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字stepKeystring必須The key of the email step, from the definition getAutomation returns.
1〜64文字tostringWhere the test goes, when not to the user themselves.
320文字まで形式email
ほかの提供先
listAutomationVersions
The published versions of an automation, the newest first: number, when it was published and whether it is the one running. includeDefinitions adds each definition as JSON. restoreAutomationVersion copies one back into the draft.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字includeDefinitionsboolean- 既定値
false
ほかの提供先
restoreAutomationVersion
Copy the definition of an earlier version back into the draft, replacing what the draft holds. Nothing that is running changes until publishAutomation.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字versioninteger必須The version number, from listAutomationVersions.
1以上
ほかの提供先
getAutomationStats
How one automation did over a window, 30 days by default: contacts that entered, are in it now, completed it or left early, emails sent, delivered, opened, clicked, bounced and marked as spam, and unsubscribes, in total and for each step. Opens are a floor, because many mail apps hide them. includeDaily adds a line for each day.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字sincestringWhere the window starts, as an ISO 8601 instant.
形式date-timeuntilstringWhere the window ends, as an ISO 8601 instant. Left out, now.
形式date-timeincludeDailyboolean- 既定値
false
ほかの提供先
listAutomationEnrollments
The contacts that are in an automation or have been, the most recent entry first: which step each is at, what they are waiting for, what holds a step that is due, when they move next and how it ended. Narrow it by status, by step or by a piece of the address or name. One page at a time: when more follow, the last line gives a cursor.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字statusstring- 次のいずれか
"active""completed""exited" stepKeystring- 1〜64文字
qstring- 200文字まで
limitinteger- 1以上200以下
cursorstring- 1〜64文字
ほかの提供先
- API
GET /automations/{id}/enrollments- TypeScript
automations.listEnrollments()automations.listAllEnrollments()automations.iterateEnrollments()- Python
automations.list_enrollments()automations.list_all_enrollments()automations.iterate_enrollments()- Ruby
automations.list_enrollmentsautomations.list_all_enrollmentsautomations.iterate_enrollments- PHP
automations->listEnrollmentsautomations->listAllEnrollmentsautomations->iterateEnrollments- Go
Automations.ListEnrollmentsAutomations.ListAllEnrollmentsAutomations.IterateEnrollments- Java
automations().listEnrollmentsautomations().listAllEnrollmentsautomations().iterateEnrollments- C#
Automations.ListEnrollmentsAsyncAutomations.ListAllEnrollmentsAsyncAutomations.IterateEnrollmentsAsync
getAutomationEnrollment
One contact's way through an automation: where they are, and what each step did for them, oldest first, such as an email sent, a wait, a yes or no at a branch, or why a step was skipped or failed.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字enrollmentIdstring必須The enrollment, by id (aen_...), from listAutomationEnrollments.
1〜64文字
ほかの提供先
enrollInAutomation
Put one contact into a live automation at its first step, whatever starts it normally, so its emails start going to them. The contact has to exist already. A contact is in an automation once at a time, and an address that is suppressed or unsubscribed is refused.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字emailstring必須The contact to enroll, by email address.
320文字まで形式emaildataRecord<string, any>Values the steps read wherever a value comes from the event, such as an order number. At most 50 keys and 4 KB of JSON.
ほかの提供先
removeFromAutomation
Take one contact out of an automation at once, by the id of their enrollment from listAutomationEnrollments. They get nothing more from it, and stay in the contacts and in their audiences.
入力
idstring必須The automation, by id (aut_...). listAutomations finds it by name.
1〜64文字enrollmentIdstring必須The enrollment, by id (aen_...), from listAutomationEnrollments.
1〜64文字
ほかの提供先
sendContactEvent
Record that something happened to one contact, such as order.placed or trial.started. Every live automation that starts on that event name takes the contact in, so its emails start going to them, and a wait step holding out for the name moves on. The answer says which automations it started. Events are kept for 90 days.
入力
namestring必須What happened, such as order.placed: letters, digits, dots, colons, dashes and underscores. Names are matched exactly, case included.
1〜100文字emailstring必須The contact the event is about, by email address.
320文字まで形式emailpropertiesRecord<string, any>Details of the event as a JSON object, at most 50 keys and 4 KB. An event trigger can filter on them and steps can use them.
occurredAtstringWhen it happened, as an ISO 8601 instant. Left out, it is now. Not in the future, and at most 90 days ago.
形式date-timecreateContactbooleantrue adds the address to the contacts when nobody has it yet.
contactNamestringThe name to give a contact that createContact adds.
200文字まで
sendContactEvents
Record up to 100 events in one call, each handled as sendContactEvent handles one, in order. One event failing does not stop the rest: the answer says which were recorded, what each started, and why any was not.
入力
eventsobject[]必須- 1〜100件
namestring必須What happened, such as order.placed: letters, digits, dots, colons, dashes and underscores. Names are matched exactly, case included.
1〜100文字emailstring必須The contact the event is about, by email address.
320文字まで形式emailpropertiesRecord<string, any>Details of the event as a JSON object, at most 50 keys and 4 KB. An event trigger can filter on them and steps can use them.
occurredAtstringWhen it happened, as an ISO 8601 instant. Left out, it is now. Not in the future, and at most 90 days ago.
形式date-timecreateContactbooleantrue adds the address to the contacts when nobody has it yet.
contactNamestringThe name to give a contact that createContact adds.
200文字まで
listContactEventNames
The names of the events this workspace has recorded in the last 90 days, to choose the event that starts an automation or that a wait step holds out for.
入力
入力はありません。
ほかの提供先
listContactEvents
The events recorded for one contact in the last 90 days, the most recent first: name, when it happened and its properties. Narrow it to one event name. One page at a time: when more follow, the last line gives a cursor.
入力
emailstring必須The contact the event is about, by email address.
3〜320文字namestring- 1〜100文字
limitinteger- 1以上200以下
cursorstring- 1〜64文字
ほかの提供先
- API
GET /contacts/{email}/events- TypeScript
contacts.listEvents()contacts.listAllEvents()contacts.iterateEvents()- Python
contacts.list_events()contacts.list_all_events()contacts.iterate_events()- Ruby
contacts.list_eventscontacts.list_all_eventscontacts.iterate_events- PHP
contacts->listEventscontacts->listAllEventscontacts->iterateEvents- Go
Contacts.ListEventsContacts.ListAllEventsContacts.IterateEvents- Java
contacts().listEventscontacts().listAllEventscontacts().iterateEvents- C#
Contacts.ListEventsAsyncContacts.ListAllEventsAsyncContacts.IterateEventsAsync