Module: Mailblastr::Events
- Defined in:
- lib/mailblastr/events.rb
Overview
Custom events that automations trigger on. Events are DOMAIN-FIRST:
domain is required on send, and only that domain's automations fire.
Class Method Summary collapse
-
.create(params, options = {}) ⇒ Object
Create a custom-event definition (name + optional payload schema).
-
.delete(event_id) ⇒ Object
Delete a custom-event definition.
-
.list(params = {}) ⇒ Object
List custom-event definitions.
-
.send(params, options = {}) ⇒ Object
Send a custom event.
Class Method Details
.create(params, options = {}) ⇒ Object
Create a custom-event definition (name + optional payload schema). POST /events Mailblastr::Events.create({ name: "signup.completed", schema: { plan: "string" } })
20 21 22 |
# File 'lib/mailblastr/events.rb', line 20 def create(params, = {}) Client.request(:post, "/events", body: params, options: ) end |
.delete(event_id) ⇒ Object
Delete a custom-event definition. DELETE /events/:id
30 31 32 |
# File 'lib/mailblastr/events.rb', line 30 def delete(event_id) Client.request(:delete, "/events/#{Client.path_escape(event_id)}") end |
.list(params = {}) ⇒ Object
List custom-event definitions. GET /events
25 26 27 |
# File 'lib/mailblastr/events.rb', line 25 def list(params = {}) Client.request(:get, "/events", query: Client.pagination(params)) end |
.send(params, options = {}) ⇒ Object
Send a custom event. POST /events/send
Mailblastr::Events.send({ event: "signup.completed", domain: "yourdomain.com",
email: "user@example.com", payload: { plan: "pro" } })
Identify the contact by contact_id OR email. Pass
{ idempotency_key: "..." } as the second argument to retry safely.
13 14 15 16 |
# File 'lib/mailblastr/events.rb', line 13 def send(params, = {}) Client.require_domain!(params, "Events.send") Client.request(:post, "/events/send", body: params, options: ) end |