پرش به مستندات
Python

خودکارسازی‌ها

`automations.list`، `get`، `create`، `update`، `publish`، `pause`، `resume`، `archive`، `duplicate`، `delete`، `send_test`، `stats`، `list_versions`، `restore_version`، `list_starters`، `list_enrollments`، `get_enrollment`، `enroll` و `exit_enrollment`، همراه با `events.send`، `send_batch` و `list_names`.

همهٔ متدها

automations.py
from openemail import openemail automation = openemail.automations.create({    'name': 'Welcome series',    'starter': 'welcome-series',    'settings': {'timezone': 'Europe/London'},}) saved = openemail.automations.update(automation['id'], {    'definition': {        **automation['definition'],        'trigger': {'kind': 'event', 'eventName': 'trial.started', 'filters': []},    },    'expectedUpdatedAt': automation['updatedAt'],}) blocking = [problem for problem in saved['problems'] if problem['blocking']]if blocking:    raise RuntimeError(blocking[0]['message']) openemail.automations.send_test(saved['id'], {'stepKey': saved['definition']['entry'] or ''})live = openemail.automations.publish(saved['id']) sent = openemail.events.send(    {        'name': 'trial.started',        'email': '[email protected]',        'properties': {'plan': 'starter'},        'createContact': True,    },    idempotency_key='trial:[email protected]',) for enrollment in openemail.automations.iterate_enrollments(live['id'], status='active'):    if enrollment['heldFor']:        print(enrollment['contact']['email'], enrollment['heldFor']) stats = openemail.automations.stats(live['id'])history = openemail.contacts.list_events('[email protected]', name='trial.started') openemail.automations.pause(live['id'])openemail.automations.resume(live['id']) print(sent['enrolled'], stats['totals']['entered'], len(history['items']))

هر خودکارسازی یک definition پیش‌نویس و نسخهٔ published را که اجرا می‌شود نگه می‌دارد. update پیش‌نویس و تنظیمات را تغییر می‌دهد، و publish پیش‌نویس را به‌عنوان نسخهٔ بعدی ثابت می‌کند و خودکارسازی را روشن می‌کند. problems می‌گوید چه چیزی هنوز جلوی انتشار پیش‌نویس را می‌گیرد، و expectedUpdatedAt ذخیره‌ای را که روی ذخیرهٔ کس دیگری بنویسد با 409 version_conflict رد می‌کند.

خواندن به automations:read و تغییر دادن به automations:write نیاز دارد. publish، resume و send_test به emails:send هم نیاز دارند. events.send و events.send_batch به contacts:write نیاز دارند، و contacts.list_events به contacts:read. delete از توکن دسترسی OAuth کد تأیید هویت می‌خواهد، و از کلید API هرگز.

events.send_batch تا 100 رویداد می‌پذیرد و هرگز برای یک رویداد نادرست خطا raise نمی‌کند: پاسخ accepted و failed را فهرست می‌کند، هر کدام با index رویداد در فهرستی که فرستادید.

attributes در یک مخاطب فیلدهای سفارشی آن را نگه می‌دارد، و خودکارسازی هر کدام را به‌صورت attributes.<key> می‌خواند.

مرجع