Sync orders from REST webhook to MySQL and Lambda

Developer ToolAPI IntegrationDatabase

What it does

When someone posts an order via REST webhook, this automation retrieves the discount and inserts the order into MySQL. If the discount exceeds zero, it invokes an AWS Lambda function to process the order further.

Who it's for

Operations teams who need to log orders and trigger downstream processing without manual steps.

How teams use this

Log all orders in a database

Store every incoming order in MySQL so the team has a complete record for reporting and audits. The webhook triggers the flow automatically without anyone having to enter data manually.

Route high-discount orders to fulfillment

Send orders with discounts above a certain amount to AWS Lambda for priority processing. This ensures promotional orders get expedited handling while standard orders follow the normal path.

Add customer name to the database record

Include a customer name field in the MySQL insert so each order row contains contact information. Set the field to pull from the REST webhook payload.

How it works

  1. Receive order via REST webhook. A REST webhook receives a new order with customer and product details in real time from an external system.
  2. Retrieve the discount amount. Call a REST endpoint to fetch the discount amount associated with that order from the pricing service.
  3. Insert order into MySQL. Add a new row to the orders table in MySQL with the order details, customer information, and discount amount.
  4. Invoke Lambda when discount exceeds threshold. If the discount from step 2 is greater than zero, invoke an AWS Lambda function to process the order for fulfillment.