Call

Automated Sales Flow Tutorial

Objective: Sell a Product and Generate an Invoice

 

This tutorial demonstrates how to build a flow that lets a user select a product, make a payment, and receive a PDF invoice.

Nodes we will use: `Keyword Trigger`, `Table Get Row`, `Branch`, `Ecocash Payment`, `Generate Document`, `Send Message`.

 

Step 1: Set Up Your Products Table

 

First, create a `Data Table` named `Products` with the following columns:

  • `product_name` (Text)
  • `price` (Number)
  • `description` (Text)

Add a few sample products to this table manually from the Data Sidebar.

 

Step 2: Build the Sales Flow

 

  1. Start with a Keyword: Use a `Keyword Trigger` node with the keyword "buy".
  2. Ask for Product: Connect a `Question` node asking "What product would you like to buy?" and save the answer to `product_query`.
  3. Find the Product: Add a `Table Get Row` node.
    • Select the `Products` table.
    • Set the condition: `product_name` contains `{{product_query}}`.
    • Save the result to a variable named `found_product`.
  4. Branch if Found: Add a `Branch` node to check if a product was found. The condition is `{{found_product}}` is not empty.
  5. "False" Path (Not Found): Connect the `false` handle to a `Message` node that says "Sorry, we couldn't find that product." and then to an `End Flow` node.
  6. "True" Path (Found): From the `true` handle, connect a `Message` node that says: "Great! I found the {{found_product.product_name}} for ${{found_product.price}}. Please confirm the payment."
  7. Take Payment: Connect an `Ecocash Payment` node. Set the amount to `{{found_product.price}}`.
  8. Handle Payment Failure: Connect the `failure` handle of the payment node to a `Message` node saying "Payment failed. Please try again."
  9. Handle Payment Success: From the `success` handle, connect a `Generate Document` node.
    • Set Template to "Invoice".
    • Set Data Source to a JSON object. You can construct this in a `Set Variable` node first, or write it directly: `{"customer_name": "{{contact_name}}", "product": "{{found_product.product_name}}", "amount": "{{found_product.price}}"}}`
    • Set Output URL Variable to `invoice_url`.
  10. Send the Invoice: Connect a `PDF` node. Set the PDF URL to `{{invoice_url}}` and add a caption like "Thank you for your purchase! Here is your invoice."
  11. End Flow: Connect the `PDF` node to an `End Flow` node.

Zimflow AI Assistant

Still need help?

Contact Support