Functions

Create function triggers

Subscribe a function to one or more event types, optionally scoped to specific senders. Provide eventTypes and senderIds (use null in senderIds for all senders); a trigger is created for each event type and sender combination.

The special event type cron runs the function on a schedule instead of a messaging event: include a cron field with a 5-field UTC cron expression (minimum granularity one minute). A cron trigger ignores the sender axis, and a function may hold several cron triggers with different expressions. The function receives an event with type: "cron" and data.cron.

post/v1/functions/{functionId}/triggers

Path parameters

functionIdstring required

Zavu Function ID.

Request body

eventTypesstring[] required

Event types to subscribe to.

senderIdsstring[] required

Senders to scope the triggers to. Use null for all senders.

cronstring

Required when eventTypes includes cron: a 5-field cron expression (minute hour day-of-month month day-of-week), evaluated in UTC.

Example request

{
  "cron": "0 9 * * 1-5"
}

Response

Triggers created.

addedinteger required
skippedinteger required

Number of triggers that already existed.

Example response

{
  "triggers": [
    {
      "cron": "*/15 * * * *"
    }
  ]
}

Changes

Changed in 2 of the 66 revisions of this API.5

    • added the new optional request property cron

      new-optional-request-property

    • added the optional property triggers/items/cron to the response with the 201 status

      response-optional-property-added

    • added the optional property triggers/items/lastRunAt to the response with the 201 status

      response-optional-property-added

    • added the optional property triggers/items/nextRunAt to the response with the 201 status

      response-optional-property-added

    • endpoint added

      endpoint-added

    This revision also has 5 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog