Otomasyonlar
`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` ve `exit_enrollment`, ayrıca `events.send`, `send_batch` ve `list_names`.
Her yöntem
automation = client.automations.create( name: "Welcome series", starter: "welcome-series", settings: {timezone: "Europe/London"}) trigger = {kind: "event", eventName: "trial.started", filters: []}saved = client.automations.update( automation[:id], definition: automation[:definition].to_h.merge(trigger: trigger), expectedUpdatedAt: automation[:updatedAt]) blocking = saved[:problems].to_a.find { |problem| problem[:blocking] }raise blocking[:message] if blocking client.automations.send_test(saved[:id], stepKey: saved.dig(:definition, :entry))live = client.automations.publish(saved[:id]) sent = client.events.send( name: "trial.started", email: "[email protected]", properties: {plan: "starter"}, createContact: true, idempotency_key: "trial:[email protected]") client.automations.iterate_enrollments(live[:id], status: "active") do |enrollment| puts "#{enrollment.dig(:contact, :email)} #{enrollment[:heldFor]}" if enrollment[:heldFor]end stats = client.automations.stats(live[:id])history = client.contacts.list_events("[email protected]", name: "trial.started") client.automations.pause(live[:id])client.automations.resume(live[:id]) puts sent[:enrolled], stats.dig(:totals, :entered), history.items.sizeBir otomasyon bir taslak definition ve çalışan published sürümü tutar. update taslağı ve ayarları değiştirir, publish ise taslağı sonraki sürüm olarak dondurur ve otomasyonu etkinleştirir. problems, bir taslağın yayımlanmasını hâlâ neyin engellediğini söyler, expectedUpdatedAt ise başka birinin kaydının üzerine yazacak bir kaydı 409 version_conflict ile reddeder.
Okumak automations:read, değiştirmek automations:write gerektirir. publish, resume ve send_test ayrıca emails:send gerektirir. events.send ve events.send_batch için contacts:write, contacts.list_events için contacts:read gerekir. delete, bir OAuth erişim tokenından doğrulama kodu ister, bir API anahtarından ise asla istemez.
events.send_batch en fazla 100 olay alır ve tek bir hatalı olay için asla hata fırlatmaz: yanıt accepted ve failed listelerini verir, her biri olayın gönderdiğiniz listedeki index değeriyle.
Bir kişideki attributes özel alanlarını tutar ve bir otomasyon bunlardan birini attributes.<key> olarak okur.