문서로 건너뛰기
CLI

자동화와 이벤트

자동화, 그 안의 사람들, 자동화를 움직이는 이벤트를 위한 모든 명령과 실제 예제.

전체가 어떻게 맞물리는지

자동화는 트리거 하나와 단계 트리로 이루어집니다. 초안과 게시 중인 버전을 유지하며, update는 초안과 설정을 바꾸고 publish는 초안을 확정하고 자동화를 켭니다. 읽기에는 automations:read, 변경에는 automations:write가 필요합니다. publish, resume, send-test는 자동화가 메일을 보내게 하므로 emails:send도 필요합니다.

터미널
openemail automations create --name "Welcome series" --starter welcome-seriesopenemail automations update aut_5c1e9a7b3d2f48e6a0b4c7d1 --data @welcome.jsonopenemail automations publish aut_5c1e9a7b3d2f48e6a0b4c7d1openemail automations stats aut_5c1e9a7b3d2f48e6a0b4c7d1

정의는 JSON이므로 파일에 써서 --data @file로 넘기세요. openemail automations get <id> --json은 현재 정의를 출력하며, 그 problems에는 아직 게시를 막고 있는 것이 나열됩니다.

자동화

명령하는 일
openemail automations list자동화 한 페이지, 최근에 바뀐 순. --status로 draft, live, paused, archived 중 하나로 좁힙니다
openemail automations create --name <value>--starter에서, --data의 정의에서, 또는 빈 상태로 초안을 만듭니다
openemail automations get <id>자동화 하나와 그 초안, 게시 중인 버전, 설정, 초안의 문제점
openemail automations update <id>이름, 설정 또는 초안 정의를 바꿉니다. --expected-updated-at을 쓰면 읽은 뒤에 생긴 변경을 덮어쓰지 않고 거부합니다
openemail automations publish <id>초안을 다음 버전으로 확정하고 자동화를 켭니다
openemail automations pause <id>게시 중인 자동화를 멈춥니다. 참여 중인 사람은 모두 제자리에서 기다립니다
openemail automations resume <id>일시 중지된 자동화를 실행하던 버전 그대로 다시 켭니다
openemail automations archive <id>자동화를 영구히 종료하고 기록은 남깁니다. 참여 중인 사람은 모두 나갑니다
openemail automations duplicate <id>자동화를 사람과 수치는 빼고 새 초안으로 복사합니다
openemail automations delete <id>확인을 거쳐 자동화와 그 기록을 삭제합니다. 브라우저 로그인에서는 인증 코드도 요구합니다
openemail automations list-starters새 자동화를 시작할 수 있는 시작점

테스트, 버전, 수치

명령하는 일
openemail automations send-test <id> --step-key <value>초안의 이메일 단계 하나를 샘플 값으로 채워 본인에게, 또는 --to로 보냅니다. 아무도 추가되지 않습니다
openemail automations list-versions <id>게시된 모든 버전, 최신순
openemail automations restore-version <id> <version>이전 버전을 초안으로 다시 복사합니다. 실행하려면 게시하세요
openemail automations stats <id>합계, 단계별 행, 날짜별 점. --since는 기간의 시작을 정하며, 기본값은 최근 30일입니다

자동화에 참여 중인 사람

명령하는 일
openemail automations list-enrollments <id>들어온 사람을 최신순으로, 각자 있는 단계와 함께 보여 줍니다. --status와 --step-key로 좁히고, --all은 모든 페이지를 읽습니다
openemail automations get-enrollment <id> <enrollment-id>한 사람의 실행 내역. 실행된 모든 단계와 각 발송으로 만들어진 이메일이 함께 나옵니다
openemail automations enroll <id> --email <value>연락처를 게시 중인 자동화의 첫 단계에 넣습니다. --contact-id를 쓰면 연락처를 id로 지정합니다
openemail automations exit-enrollment <id> <enrollment-id>끝나기 전에 사람 내보내기
터미널
openemail automations list-enrollments aut_5c1e9a7b3d2f48e6a0b4c7d1 --status active --all --json | jq -r '.items[] | .contact.email + " " + (.stepKey // "")'

일정

이벤트는 연락처가 제품에서 무언가를 했음을 알립니다. 트리거가 그 이벤트를 지정한 모든 게시 중 자동화를 시작하고, 그 이벤트를 기다리던 사람을 다음으로 넘깁니다. 이벤트를 보내려면 contacts:write가 필요합니다.

명령하는 일
openemail events send --name <value> --email <value>연락처의 이벤트 하나를 기록합니다. --create-contact는 그 주소를 가진 연락처가 아직 없을 때 연락처를 추가하고, --idempotency-key는 재시도를 안전하게 만듭니다
openemail events send-batch <events>JSON 파일에서 이벤트를 최대 100개까지 기록하고, 수락된 것과 거부된 것을 출력합니다
openemail events list-names워크스페이스가 보낸 이벤트 이름. 트리거에서 하나를 고를 때 씁니다
openemail contacts list-events <email>연락처 하나가 한 이벤트, 최신순. --name으로 이벤트 하나로 좁힙니다
터미널
openemail events send --data '{"name":"order.placed","email":"[email protected]","properties":{"orderId":"AC-4192"}}' --idempotency-key order:AC-4192:placedopenemail events send-batch @events.jsonopenemail contacts list-events [email protected] --name order.placed

속성은 JSON 본문에 들어가므로, 속성이 있는 이벤트는 --data로 보내세요. 이벤트는 90일 동안 보관됩니다.