Class: Courier::Resources::Journeys::Runs

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

Overview

Build, version, publish, invoke, and cancel multi-step notification workflows, along with the templates scoped to them.

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:



98
99
100
# File 'lib/courier/resources/journeys/runs.rb', line 98

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::JourneyRunListResponse

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

List runs of the workspace's Journeys, newest first, filtered by status, Journey, or date range and paged by cursor. Runs of v2 Automations are listed by GET /automations/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 Journey ids to filter on.

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

Returns:

See Also:



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

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

#list_steps(run_id, request_options: {}) ⇒ Courier::Models::JourneyRunStepsResponse

List the per-node state of one Journey run, in full — this endpoint is not paginated. Each step's node_id is the id of the node in the published Journey, so a step maps directly onto the Journey graph. message_id is present on send steps that produced a message; follow it to GET /messages/{message_id} for delivery status.

Parameters:

  • run_id (String)

    A unique identifier representing the Journey run.

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

Returns:

See Also:



86
87
88
89
90
91
92
93
# File 'lib/courier/resources/journeys/runs.rb', line 86

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

#retrieve(run_id, request_options: {}) ⇒ Courier::Models::JourneyRunResponse

Fetch one Journey run by id. Returns 404 for an unknown run, a run belonging to another workspace, a run past the 95-day retention window, or an Automation run id — the same body in every case, so the response never reveals whether a run exists elsewhere.

Parameters:

  • run_id (String)

    A unique identifier representing the Journey run.

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

Returns:

See Also:



23
24
25
26
27
28
29
30
# File 'lib/courier/resources/journeys/runs.rb', line 23

def retrieve(run_id, params = {})
  @client.request(
    method: :get,
    path: ["journeys/runs/%1$s", run_id],
    model: Courier::JourneyRunResponse,
    options: params[:request_options]
  )
end