Start instance and complete a step (script)
Use this Python script to automatically create workflow instances and complete steps programmatically. Use case: Create a new employee onboarding workflow, automatically complete the first step by, for example, automatically filling in personal details, and advance to the next step.- The script creates an instance with process_id and tags. The name is created automatically as per Next Matter settings.
- Uses the API endpoint: https://core.nextmatter.com/api/instances/
- Returns:
- Instance ID (for reference)
- Instance URL (for navigation)
- If an error occurs, it prints the error message.
- Fills the step with the required input data and marks a step in the workflow as completed.
- Uses the API endpoint: https://core.nextmatter.com/api/instances//complete_step/
- Requires:
- Instance ID (to specify the workflow instance)
- Step ID (which step to complete)
- List of form fields ( with input data required for the step to complete) If successful, shows a completion message.
Script
Script
Filter instances by max total runtime
Use case: Find all workflow instances that completed within a specific time frame. You can use this API call to get filtered instances of a workflow. In the example below, we’re filtering for all instances with a maximum total runtime of 50 seconds.- 01 09:30 - 1 day and 9 minutes and 30 seconds
- 02:30:00 - 2 hours and 30 minutes (and 0 seconds)
- PT50M - 50 minutes (as per ISO 8601 duration formats)
- PT1H30S - 1 hour and 30 seconds (as per ISO 8601 duration formats)