Knock.Workflows (Knock v0.4.14) View Source

Functions for interacting with Knock notify resources.

Link to this section Summary

Functions

Cancels the workflow with the given cancellation key.

Creates schedule instances for the specified recipients on the properties map.

Delete schedule instances.

Returns paginated schedules for the provided environment

Executes a notify call for the workflow with the given key.

Updates schedule instances with argument properties.

Link to this section Functions

Link to this function

cancel(client, key, cancellation_key, properties \\ %{})

View Source

Specs

Cancels the workflow with the given cancellation key.

Can optionally be provided with:

  • recipients: A list of recipients to cancel the notify for
Link to this function

create_schedules(client, key, properties \\ %{})

View Source

Specs

create_schedules(Knock.Client.t(), String.t(), map()) :: Knock.Api.response()

Creates schedule instances for the specified recipients on the properties map.

Expected properties:

  • recipients: list of recipients for schedules to be created for
  • actor: actor to be used when trigger the target workflow
  • repeats: repeat rules to specify when the workflow must be triggered
  • data: data to be used as variables when the workflow runs
  • tenant: tenant id to be used for when the workflow runs
Link to this function

delete_schedules(client, schedule_ids)

View Source

Specs

delete_schedules(Knock.Client.t(), [String.t()]) :: Knock.Api.response()

Delete schedule instances.

Link to this function

list_schedules(client, key, options \\ [])

View Source

Specs

list_schedules(Client.t(), String.t(), Keyword.t()) :: Knock.Api.response()

Returns paginated schedules for the provided environment

Available optional parameters:

#

- page_size: specify size of the page to be returned by the api. (max limit: 50)

- after: after cursor for pagination

- before: before cursor for pagination

- tenant: tenant_id to filter schedues with

- recipients: list of recipients to filter schedules with

Link to this function

trigger(client, key, properties, options \\ [])

View Source

Specs

Executes a notify call for the workflow with the given key.

Note: properties must contain at least recipents for the call to be valid.

Options can include:

  • idempotency_key: A unique key to prevent duplicate requests
Link to this function

update_schedules(client, schedule_ids, properties \\ %{})

View Source

Specs

update_schedules(Knock.Client.t(), [String.t()], map()) :: Knock.Api.response()

Updates schedule instances with argument properties.

Expected properties:

  • actor: actor to be used when trigger the target workflow
  • repeats: repeat rules to specify when the workflow must be triggered
  • data: data to be used as variables when the workflow runs
  • tenant: tenant id to be used for when the workflow runs