Requirements
- You have read the API overview guide
- You have read the API integration guide
- You have read the Create tasks guide
- (optional) You have read the Map IDs guide
Relevant API endpoints
POST /tasks
: create a taskPUT /tasks/:id
: create or update a task (idempotent)PATCH /tasks/:id
: update a taskPOST /tasks/batch
: bulk create tasksPUT /tasks/batch
: bulk create or update tasks (idempotent)PATCH /tasks/batch
: bulk update tasks
Approaches
The goal is to create a task in Fragment when an event occurs in your existing system. At a high-level, the steps are:- Trigger (in your system)
- Create / update task (in Fragment)
1. Create and forget.
This is the simplest approach. You create a task in Fragment and let the Fragment workflow handle the rest. The task will be processed by your team and closed when completed. This is the recommended approach for most use cases as there is no conflict with your existing system and clear separation of concerns. Fragment is responsible for the task management, and you’re responsible for the business logic.In this scenario, having a clear ID mapping strategy is still a good idea for idempotency reasons. See Map task IDs for more details.
2. Control the full task lifecycle.
In this approach, the status of the Fragment task is managed by your system. Maybe you create multiple tasks on Fragment for the same process on your side.When controlling the full task lifecycle, ensure you:
- Close tasks when they become irrelevant or are completed outside of Fragment
- Update task status to reflect the current state in your system
- Handle edge cases like duplicate task creation
- Implement proper error handling and retry logic to maintain data consistency
Examples
Example 1: Onboarding (create and forget)
When a new user completes onboarding in your system, you can automatically create a task in Fragment to let your team know about it. In the code, it might look like this:onboarding.py
Example 2: Workflow hooks (control the full task lifecycle)
If your system is running a multi-step workflow, you can create a task in Fragment at various steps of the process. For example, suppose your system is handling health insurance claims. Processing a claim might require multiple steps:- Data entry
- Review
- Approval
- Payment
- Create a task in Fragment at each step of the process
- Create a single task in Fragment at the beginning of the process and update the status at each step.
workflow.py
Going further
-
It’s possible to push comments on the Fragment task. See
POST /tasks/{uid}/comments
for more details. -
It’s possible to assign a Fragment task to an operator by pushing the
assignee_email
in the payload (no need to map user ids). SeePOST /tasks
for more details. -
It’s possible to search tasks on Fragment. See
GET /tasks
for more details.