In this example, we use Execute JavaScript to segment products and filter the client, suggesting the product that best matches their current level of knowledge.
This functionality is especially recommended for infoproduct creators or affiliates.
- First, in the automation flow, we ask the client to inform us of their knowledge level.
- Next, we save the client’s response in the variable
payload.level
.
- In Execute JavaScript, we use the variable
payload.level
to filter the client’s level of knowledge.
- Finally, the result of the code will be saved in the variable
payload.recommendation
, which is sent to the client in the final message indicating the suggested product based on the level of knowledge they provided.
var level = payload.level.toLowerCase(); // Converting to lowercase for standardization
if (level === 'beginner') {
payload.recommendation = 'Course: Introduction to the Market';
} else if (level === 'intermediate') {
payload.recommendation = 'Course: Professional Development';
} else if (level === 'advanced') {
payload.recommendation = 'Course: Career and Financial Planning';
} else {
payload.recommendation = 'Knowledge level not recognized. Please check your response and try again.';
}
Responses are generated using AI and may contain mistakes.