Class: Courier::Resources::Automations::Runs

Inherits:
Object
  • Object
show all
Defined in:
lib/courier/resources/automations/runs.rb,
sig/courier/resources/automations/runs.rbs

Overview

Invoke a stored automation template or an ad hoc automation defined in the request.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Runs

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Runs.

Parameters:



74
75
76
# File 'lib/courier/resources/automations/runs.rb', line 74

def initialize(client:)
  @client = client
end

Instance Method Details

#list(cursor: nil, end_date: nil, limit: nil, start_date: nil, status: nil, template_id: nil, request_options: {}) ⇒ Courier::Models::AutomationRunListResponse

Some parameter documentations has been truncated, see Models::Automations::RunListParams for more details.

List runs of the workspace's v2 Automations, newest first, filtered by status, Template, or date range and paged by cursor. Journey (v3) runs are listed by GET /journeys/runs instead — the two surfaces never return each other's runs. Runs are retained for 95 days.

Parameters:

  • cursor (String)

    A cursor token for pagination. Use the next_cursor from the previous response

  • end_date (String)

    An inclusive upper bound on created_at, in the same format as start_date.

  • limit (String)

    The number of runs to return per page, between 1 and 50. Defaults to 20. V

  • start_date (String)

    An inclusive lower bound on created_at, as an ISO 8601 date or timestamp (e.g.

  • status (String)

    A comma-separated list of run statuses to filter on, e.g. PROCESSED,ERROR.

  • template_id (String)

    A comma-separated list of Automation Template ids to filter on.

  • request_options (Courier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/courier/resources/automations/runs.rb', line 36

def list(params = {})
  parsed, options = Courier::Automations::RunListParams.dump_request(params)
  query = Courier::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "automations/runs",
    query: query,
    model: Courier::AutomationRunListResponse,
    options: options
  )
end

#list_steps(id, request_options: {}) ⇒ Courier::Models::AutomationRunStepsResponse

List the per-step state of one Automation run, in full — this endpoint is not paginated. message_id is present on send steps that produced a message; follow it to GET /messages/{message_id} for delivery status. A send to a List or an Audience yields one message_id for the request, not one per recipient.

Parameters:

  • id (String)

    A unique identifier representing the Automation run.

  • request_options (Courier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



62
63
64
65
66
67
68
69
# File 'lib/courier/resources/automations/runs.rb', line 62

def list_steps(id, params = {})
  @client.request(
    method: :get,
    path: ["automations/runs/%1$s/steps", id],
    model: Courier::AutomationRunStepsResponse,
    options: params[:request_options]
  )
end