API-driven checklist items are a big help when you need more advanced onboarding flows. For instance, if you want the user to fill multiple forms and finish an advanced account setup, it would be quite difficult to accomplish this using Product Fruits base functionalities. API-driven items are completely controlled by your code.
First, add an API-driven item in the Product Fruits administration.
You must assign an Internal ID. By this ID, you will identify the item in your code. It can be any string.
Listen to the item-launched
event and launch any action you need in your code.
window.productFruits.api.checklists.listen('item-launched', (id, internalId) => {
console.log('Identify the item by internalId and launch an action.');
});
When the action in your application is done, you probably wish to mark the item as completed.
window.productFruits.api.checklists.markItemAsDone(internalId, true);
Pass internalId
and that's it. If you want the checklists popup to be expanded, set the second parameter to true
.