API-driven checklist items

If tours or URL links are not enough in your checklists, the API-driven items are here for you.

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.

How to use API-driven checklist items

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.

Code flow

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.