Skip to main content
This example demonstrates a complete, realistic, and robust workflow for a production application. The application triggers a Lume pipeline and then uses a webhook to asynchronously receive and process the results when the run is complete. This architectural pattern is highly recommended for event-driven systems as it is more scalable than polling for status.

Scenario

A Python application needs to process new customer registration CSVs as they arrive. The process is:
  1. A new CSV file of raw customer data is uploaded to a specific S3 location.
  2. The application triggers a Lume pipeline, pointing to the S3 object’s path.
  3. The application does not block or wait. It relies on Lume to call it back when the job is done.
  4. When Lume sends a webhook notification, the application fetches the run status and, on success, adds the event to a downstream processing queue.

The Application Code

This example uses the Flask web framework (pip install Flask).

How to Run This Example

  1. Install Dependencies:
  2. Set Environment Variables:
  3. Expose Your Local Server: Lume’s cloud platform needs to be able to reach your local machine. Use a tool like ngrok to create a secure public URL for your local server.
    This will give you a public URL like https://<unique_id>.ngrok.io.
  4. Configure Webhook in Lume: In the Lume UI for your customer_cleaner Flow, add a new Webhook Notification pointing to your ngrok URL (e.g., https://<unique_id>.ngrok.io/lume-webhook).
  5. Run the Application:
    The script will first trigger the run and then start the web server. When Lume finishes the run, you will see the webhook request printed in your terminal, followed by the simulated worker processing.

Sample Data

Sample Input

(Contents of new_customers.csv uploaded to S3)

Sample Output

(Contents of the mapped CSV file in the target S3 location, available to the background worker) Notice how the Flow Version standardized the name and email (trimming whitespace), prefixed the ID, and added a default is_premium flag.