Knock.Workflows (Knock v0.4.18)
View SourceFunctions for interacting with Knock notify resources.
Summary
Functions
Creates schedule instances in bulk.
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.
Functions
@spec bulk_create_schedules(Knock.Client.t(), [map()]) :: Knock.Api.response()
Creates schedule instances in bulk.
Accepts a list of schedules and creates them asynchronously. The endpoint returns a BulkOperation.
Each schedule in the list should contain:
- recipient: recipient for the schedule 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 to be used for when the workflow runs
- scheduled_at: ISO-8601 formatted date time for when the schedule should start
- ending_at: ISO-8601 formatted date time for when the schedule should end
@spec cancel(Knock.Client.t(), String.t(), String.t(), map()) :: Knock.Api.response()
Cancels the workflow with the given cancellation key.
Can optionally be provided with:
recipients
: A list of recipients to cancel the notify for
@spec 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 to be used for when the workflow runs
@spec delete_schedules(Knock.Client.t(), [String.t()]) :: Knock.Api.response()
Delete schedule instances.
@spec 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
@spec trigger(Knock.Client.t(), String.t(), map(), keyword()) :: Knock.Api.response()
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
@spec 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 to be used for when the workflow runs