Building a Zepto-Like Coupon Program using Nected within a Day

Building a Zepto-Like Coupon Program using Nected within a Day

Prabhat Gupta

5
 min read
Building a Zepto-Like Coupon Program using Nected within a DayBuilding a Zepto-Like Coupon Program using Nected within a Day
Clock Icon - Techplus X Webflow Template
5
 min read

Implementing an advanced coupon program can greatly improve customer engagement and drive sales. Companies like Zepto have used complex coupon systems to provide tailored discounts and rewards, attracting new customers and retaining existing ones. But how can businesses implement such detailed workflows efficiently?

Nected offers a powerful platform for creating and managing intricate workflows, including a Zepto-like coupon program. With Nected, businesses can automate coupon distribution, apply discounts promptly, and gather valuable customer data.

A well-structured coupon program offers more than just discounts. It drives customer loyalty, increases average order value, and provides useful data for refining marketing strategies. Nected enables the creation of a scalable and flexible coupon system that meets your business needs.

In this blog, we will walk you through the steps to create a Zepto-like coupon program using Nected. We will cover everything from designing decision tables to building the workflow logic. Whether you are a developer looking to simplify complex flows or a business owner aiming to improve customer engagement, this guide will provide you with the necessary knowledge and tools.

Why Choose Nected for Building Complex Flows?

Selecting the right platform for creating and managing complex workflows is crucial for efficient business operations. Nected offers several advantages that make it an excellent choice for building intricate flows like a Zepto-like coupon program.

  1. Ease of Use:Nected's visual editor makes it easy to design and manage complex workflows. With its drag-and-drop interface, users can create detailed workflows without extensive coding. This user-friendly approach allows both technical and non-technical users to build and deploy workflows efficiently, reducing the time and effort required for development.
  2. Flexibility and Scalability: Nected provides the flexibility to design workflows tailored to specific business needs. Whether your business is small or large, Nected scales seamlessly to handle increased volumes of interactions. This scalability ensures that your workflows remain effective and responsive, regardless of business growth.
  3. Robust Integration Capabilities: Nected excels in integrating with various databases, APIs, and third-party services. This capability allows businesses to connect workflows with existing systems, ensuring seamless data flow and real-time processing. For instance, when creating a coupon program, Nected can easily fetch user data, process transactions, and apply discounts by integrating with your e-commerce platform and payment gateways.
  4. Low-Code Customization: Nected offers a low-code environment that allows for significant customization without requiring deep programming expertise. Users can implement custom logic, rules, and conditions to fine-tune their workflows. This feature is particularly useful for creating personalized and complex workflows, such as a coupon program that applies specific discounts based on user behavior and purchase history.
  5. Real-Time Response and Processing: With Nected, businesses can achieve real-time response and processing, essential for applications requiring immediate actions. For example, in a coupon program, Nected ensures that discounts are applied instantly during the checkout process, providing a smooth and efficient user experience.
  6. Efficient Management of Complex Workflows: Nected allows for the efficient management of complex workflows through its decision tables and rule-based logic. For a coupon program, this means you can define detailed rules for various discounts, set conditions for their applicability, and manage all these rules centrally. This centralized management simplifies the maintenance and updating of the coupon program, ensuring consistency and accuracy.

By leveraging Nected's capabilities, businesses can build robust and scalable workflows that enhance operational efficiency and improve customer engagement. Whether you're developing a coupon program or any other complex workflow, Nected provides the necessary tools and features to meet your business needs effectively.

Designing the Coupon Flow

Before going directly to the building stage, first, let us create and understand the flow of the Zepto-like coupon program. Designing a clear and structured flow is crucial for ensuring that the coupon logic works efficiently and correctly. Here’s how the flow will look:

  1. Trigger Event: The flow begins with a trigger event, such as a user adding items to their cart or applying a coupon code during checkout.
  2. Fetch Cart and User Data: Retrieve relevant data from the cart and user details using API calls. This data includes the items in the cart, total amount, and user information.
  3. Calculate Totals: Compute the total values for the overall cart, individual categories, and specific brands. This step is essential for determining which coupons are applicable.
  4. Evaluate Coupon Conditions: Use decision tables to evaluate if the cart meets the conditions for various coupons. This includes checking minimum transaction amounts, specific product categories, and valid payment methods.
  5. Apply Applicable Coupons: Once the conditions are evaluated, apply the relevant coupons to the cart. This involves adjusting the total amount and ensuring that the discounts are correctly applied.
  6. Generate Response: Provide a response indicating the applied discounts and the final total amount. This response is then displayed to the user, showing the successful application of coupons.

This flow ensures that the coupon logic is applied correctly and efficiently, providing a seamless experience for the user. By following this structured approach, you can create a robust coupon program using Nected that meets your business requirements and enhances customer satisfaction.

Read Also: 6 Workflow Types: Examples, Pros and Cons

How Does the Zepto Coupon System Work?

The Zepto Coupon System is designed to offer a seamless and efficient user experience for applying discounts at checkout. Here’s how it works:

  1. Adding Items to the Cart: The process begins when a user adds products to their shopping cart. Each product's name, price, and quantity are displayed, contributing to the cart’s total value.
  2. Presenting Coupon Options: Once the items are in the cart, the system presents the user with the option to apply a coupon. Users can either manually enter a coupon code or choose from a list of available coupons tailored to the items in their cart.
  3. Applying the Coupon: Upon selecting a coupon, such as "ZEPTO50AU," the system triggers an API call to Nected’s backend. This call initiates the workflow that validates the coupon based on predefined rules like minimum purchase amount, eligible product categories, and the coupon's validity period.
  4. Real-Time Discount Calculation: The backend workflow calculates the discount in real-time. For instance, if the cart total is ₹800 and the coupon offers a ₹50 discount, the system immediately adjusts the total to ₹750.
  5. Displaying the Updated Cart: After the coupon is successfully applied, the updated cart total, including the original price, discount amount, and the final payable amount, is displayed to the user. This ensures transparency and clarity, enhancing the user’s shopping experience.

The system ensures that the entire process—from selecting a coupon to applying the discount and updating the cart total—happens quickly and accurately, driven by the powerful automation and rule engine provided by Nected.Step-by-Step Guide to Building the Coupon ProgramTo create a Zepto-like coupon program using Nected, you’ll need to follow a structured approach within the Nected platform. Below is a detailed guide, breaking down each step of the process.

Step to Build the Zepto Coupon Program

To create a Zepto-like coupon program using Nected, you’ll need to follow a structured approach within the Nected platform. Below is a detailed guide, breaking down each step of the process.

Step 1: Define the Workflow

To define the workflow, follow the below steps:

  1. Log in to Nected: Start by logging in to your Nected account.
  2. Navigate to the Workflow Page: Once logged in, go to the Workflow page.
  3. Create New Workflow: Click on "Create New Workflow" to initiate a new workflow. Name it appropriately, such as "Zepto Coupon Program."

Step 2: Set Up the Trigger Node

Next, after creating the workflow, open the workflow editor, begin by adding a trigger node. This node will capture user actions, such as adding items to their cart or applying a coupon code.

  1. Configure the Trigger: The trigger node needs to be set up to handle input from the frontend. You will receive cart details, user information, and other necessary parameters through an API call from your frontend.
  2. Define Input Parameters: Within the trigger node, define input parameters like which should be of type JSON. This JSON structure will include details such as product name, category, price, and quantity. Like this:
 {
  "cart_list": [
    {
      "brand": "MyGlamm",
      "category": "MakeUp & Beauty",
      "name": "Myglamm Popxo Makeup Collection Mini Kit",
      "price": 200,
      "quantity": 1,
      "totalPrice": 200
    },
    // more product details
  ],
  "email": "alice@gmail.com",
  "userId": 121
} 

  1. Test the Trigger: After defining the input parameters, test the node to ensure everything is configured correctly. Save the trigger once you confirm it works.

Step 3: Process Cart Data Using a Formula Node

After the trigger node, we need a formula node to process the cart data i.e. the overall price and other important parameters which we can use later on. Follow these steps to add the formula:

  1. Add a Formula Node: The next step is to calculate the cart's total price. Add a formula node to your workflow.
  2. Input Parameters: Use the output from the trigger node as the input for this formula node. The input parameters will include details about the items in the cart.
  3. Write the Formula: In the formula editor, write a script to calculate the cart's total price. For example:
  // Initialize
let cart = {{.Trigger.cart}}.cart_list;

// Calculate overall total
let overallTotal = SUM_LIST(list=cart, 'totalPrice');

// Initialize result array
let result = [
  {
    type: "overall",
    name: "Payment Gateway",
    value: overallTotal
  },
];
result;

  1. Test the Formula: After writing the formula, ensure the total price is calculated correctly. Save the formula once it is confirmed to be accurate.

Step 4: Create Decision Tables for Applying Coupons

Next, we will use the output from the previous nodes to create a rule based on the output values. Now, here we're going to create a decision table for applying the coupons. Because, here we're taking a decision based on the attributes. Follow the below steps to create and configure the decision table.

  1. Create a Decision Table: Add a decision table node to define the conditions under which specific coupons should be applied.
  2. Define Conditions: Within the decision table, set conditions that must be met for a coupon to be applicable. For example, you can define conditions like:
    • If the cart total is above ₹599, apply a specific coupon.
    • If the category is "Makeup & Beauty" and the total is above ₹299, apply another coupon.

Now, on the conditions you need to add all the coupons by creating rows for them. Here is how you can create and configure the rows:

  1. Define Each Coupon: For each coupon, add a row in the decision table. Specify the conditions that must be met for each coupon.
  2. Specify Outputs: For each coupon, define the output, which will be the discount applied. This might involve setting a fixed discount amount or a percentage discount.

After configuring the rows, test the decision table and save it. And then follow the below steps to add the decision table in the workflow:

  1. Go to the workflow editor and add a new "Rule node" from the options.
  2. Now, as you've created the decision table, so you can see that in the list. Select that
    rule, and a modal will be open like below.
  3. Add the required input fields there and simply test it.

After testing it, save it. And now we're ready to configure the next condition.

Step 5: Aggregate Coupons and Apply the Logic

Next we'll be taking the input from the previous rule node, to configure the applicable coupons for the cart. Here is how you can do so:

  1. Use a formula node to aggregate all applicable coupons from the decision table. This ensures that only the relevant coupons are considered for application.
 const data = {{.Zepto_Coupons_Each.output}};
const coupons = [];

data.forEach(group => {
  if (Array.isArray(group.output)) {
    group.output.forEach(coupon => {
      coupons.push(coupon);
    });
  }
});

const uniqueCoupons = [];
const seenCodes = {};

coupons.forEach(coupon => {
  if (!seenCodes[coupon.code]) {
    seenCodes[coupon.code] = true;
    uniqueCoupons.push(coupon);
  }
});

coupons; 
  1. Select the Best Coupon: If multiple coupons are applicable, write a logic to select the best coupon, or apply them according to business rules.

After configuring the formula node, next we'll create another decision table to validate the applicable coupons based on the validation period.

Here is how the second decision table will look like:

As you can see here, we're just taking the system variable named systemVar.CurrentTime which returns the current date and time. We're checking if the current date and time is lying between the Validation date or not which we've given in the result as JSON and it looks like this:

"validity_start": "2024-07-01T00:00:00Z",
"validity_end": "2024-09-31T23:59:59Z",

After configuring this, just test it and save this rule. Then come back to the workflow editor and:

  1. Add another decision table node that applies the selected coupons to the cart total.
  2. In this decision table, as we're not taking any custom inputs so, no need to configure any input parameters in the rule node.
  3. Then just test the node and save it.

Once, done, we can add the last node of the workflow.

Step 6: Generate the Response

Finally, to return all coupons along with all applicable coupons follow these steps:

  1. Create Response for Frontend: Add a response node to generate the final output, which includes the applied coupons and all the available coupons.
  2. Define Output Format: Ensure the response is in a format that can be easily consumed by the frontend. The response should include details like:
    • Applied coupon code
    • Discount amount
    • Final total after applying the coupon
  3. Test the Response: After setting up the response node, test it to ensure that the correct data is sent back to the frontend. Save the node once everything works as expected.

Step 7: Implement the "Apply Coupon" Rule

After the main workflow is in place, you'll need a separate rule to handle the process that occurs when the user clicks the "Apply" button in the front end.

  1. Navigate to the Rules Section: Go to the Rules section in Nected's dashboard and create a new rule named "Apply Coupon."
  2. Set Up the Trigger: The rule will be triggered by an API call from the front end when the user clicks the "Apply" button.

Define Input Parameters:

  1. Applied Coupon Code: Set up an input parameter for the applied_coupon, which will be the coupon code entered or selected by the user.
  2. Total Price: Include another input parameter for the total_price of the cart, as calculated in the workflow.

Configure the Logic:

  1. Match the Coupon: The rule should check if the applied_coupon matches any of the available coupons.
  2. Calculate the Discount: Once a match is found, use a simple formula to calculate the final price after applying the discount. The formula will vary depending on the type of discount (e.g., fixed amount or percentage).
  3. After setting up the rule, test it with different coupons and cart totals to ensure that it calculates the final price correctly. Once validated, save the rule.

By following these detailed steps, you can efficiently build a Zepto-like coupon program using Nected. This approach ensures a seamless experience for your customers while providing your business with a robust and scalable coupon management system.

Read Also: How to create a Swiggy-like chatbot using Nected?

Conclusion

Implementing a comprehensive coupon program can significantly enhance customer engagement and drive sales for your business. By leveraging Nected’s powerful platform, you can efficiently build and manage intricate workflows like a Zepto-like coupon program.

Nected simplifies the process with its user-friendly visual editor, allowing both technical and non-technical users to design detailed workflows without extensive coding. Its robust integration capabilities ensure seamless connectivity with various databases and third-party services, enabling real-time data processing and accurate application of coupon logic.

This guide has walked you through the steps to create a coupon program using Nected, from setting up triggers to defining decision tables and aggregating coupons. By following these steps, you can create a scalable and flexible coupon system that meets your business needs, providing a seamless experience for your customers and enhancing operational efficiency.

As you deploy and monitor your coupon program, remember to gather user feedback and analyze the performance to continually refine and improve the workflow. Nected’s platform supports ongoing optimization, ensuring that your coupon program remains effective and relevant.

Start building your Zepto-like coupon program today with Nected, and take your customer engagement and sales to the next level.

FAQs

Q1. What is Nected, and how does it help in building a coupon program?

Nected is a powerful workflow automation platform that allows you to design, manage, and deploy complex workflows with ease. It helps in building a coupon program by providing a visual editor, decision tables, and integration capabilities, making it easier to define and apply coupon logic without extensive coding.

Q2. How do I set up a trigger for the coupon workflow in Nected?

In Nected, you can set up a trigger by adding a trigger node in the visual editor. Configure the trigger to activate when a webhook is called from your frontend application, passing along necessary parameters such as cart details and user information.

Q3. Can I integrate Nected with my existing e-commerce platform?

Yes, Nected offers robust integration capabilities that allow you to connect with various databases, APIs, and third-party services. This enables seamless data flow between your existing e-commerce platform and the Nected workflow.

Q4. How do I define conditions for applying coupons in Nected?

You can define conditions for applying coupons by creating decision table nodes in Nected. These nodes allow you to set up rules and conditions for different types of discounts, such as minimum transaction amounts and specific product categories.

Q5. Is it possible to apply multiple coupons in a single transaction?

Yes, you can aggregate and apply multiple coupons in a single transaction by using code nodes to process and evaluate the applicable coupons. However, ensure that your business rules for applying multiple coupons are defined and implemented correctly in the workflow.

Q6. How can I test the coupon workflow before deploying it live?

Nected provides a testing environment where you can simulate user interactions and validate the workflow. Test different scenarios to ensure that the coupons are applied correctly and the workflow functions as expected before deploying it to your live environment.

Q7. What should I do if the coupons are not applying correctly?

If the coupons are not applying correctly, review the decision tables and logic defined in your workflow. Ensure that the conditions and rules are set up accurately. Use Nected’s debugging tools to identify and fix any issues in the workflow.

Q8. Can I update the coupon logic after deploying the workflow?

Yes, Nected allows you to update and modify the coupon logic even after deploying the workflow. You can make necessary adjustments and improvements based on user feedback and performance analysis to ensure the coupon program remains effective and relevant.

Prabhat Gupta

Prabhat Gupta

Co-founder Nected
Co-founded TravelTriangle in 2011 and made it India’s leading holiday marketplace. Product, Tech & Growth Guy.

Prabhat Gupta is the Co-founder of Nected and an IITG CSE 2008 graduate. While before Nected he Co-founded TravelTriangle, where he scaled the team to 800+, achieving 8M+ monthly traffic and $150M+ annual sales, establishing it as a leading holiday marketplace in India. Prabhat led business operations and product development, managing a 100+ product & tech team and developing secure, scalable systems. He also implemented experimentation processes to run 80+ parallel experiments monthly with a lean team.

Table of Contents
Try Nected For Free

Start using the future of Development, today