The Run Free Project offers robust webhooks for tracking key events such as customer account actions, cart changes, and order creations. Webhooks provide an efficient way to receive real-time notifications of these events, triggering custom workflows or updating external systems with live data. This guide explores how to leverage webhooks within the Run Free Project to capture customer events, cart activities, and order actions, with specific payload examples.
What are Webhooks?
Webhooks are HTTP callbacks that notify a specified URL when certain events occur in an application. When a specific action takes place (like a customer account creation or an order placement), the system sends a JSON payload containing event details to the configured URL. With Run Free Project webhooks, you can seamlessly sync your customer management, cart, and ordering data with other systems.
Setting Up Webhooks in the Run Free Project
To set up webhooks:
Navigate to your Run Free Project dashboard.
Go to the Webhooks section.
Select the types of events you want to monitor, such as
customer
,cart
, andorder
actions.Enter the destination URL where you'd like to receive the payloads.
Test the setup to ensure connectivity.
Sample Payloads and Usage
Below are example payloads for key actions: customer creation, cart changes, and order creation.
1. Customer Creation Event
This webhook is triggered when a new customer registers on the platform.
Example Payload:
{
"type": "customer",
"action": "created",
"data": {
"id": 414356,
"firstName": "Test",
"lastName": "Customer",
"email": "test@runfree.run",
"created": "2024-05-24T20:36:28.467Z",
"phone": "15558675309",
"posId": "",
"newsletter": false,
"billing": {},
"shipping": {}
}
}
Fields Breakdown:
type: Specifies the type of data (
customer
).action: Indicates the event (
created
).data: Contains details about the customer, including
id
,firstName
,lastName
,email
, andphone
.
Use Case: This webhook can be used to add new customers to a CRM system, subscribe them to a newsletter (if opted in), or trigger a welcome email sequence.
2. Cart Change Event
This webhook captures changes to a customer’s cart, including item additions or updates.
Example Payload:
{
"type": "cart",
"action": "change",
"data": {
"customer": {
"id": 1,
"firstName": "Test",
"lastName": "Customer",
"email": "test@runfree.run",
"created": "2018-11-20T06:13:40.000Z",
"phone": "15855008509",
"posId": "100005"
},
"items": [
{
"type": "product",
"quantity": 1,
"sku": "221341.018",
"productId": 135824,
"posId": "879c3617-4ba6-445c-a931-aa22011ce210",
"size": "S",
"width": "",
"store": "1",
"color": "ASPHALT ECLIPSE JACQUARD",
"name": "ARRAY TANK"
}
]
}
}
Fields Breakdown:
type: Denotes the data type (
cart
).action: The event type (
change
), triggered when items in the cart are modified.data: Contains the customer information and cart items, each with properties like
quantity
,sku
,productId
,size
, andcolor
.
Use Case: This data can be used to power abandoned cart recovery campaigns, update inventory systems in real time, or personalize the shopping experience based on the items in the cart.
3. Order Creation Event
This webhook fires when a new order is placed, providing complete order details.
Example Payload:
{
"type": "order",
"action": "created",
"data": {
"id": 448725,
"customer": {
"id": 1,
"firstName": "Test",
"lastName": "Customer",
"email": "test@runfree.run",
"created": "2018-11-20T06:13:40.000Z",
"phone": "15855008509",
"posId": "110252"
},
"ordered": "2024-07-30T01:58:08.163Z",
"note": "",
"subtotal": 130,
"shipping": {
"id": 1654862,
"label": "Jeremy Tellier",
"street": "1688 Lake Rd",
"city": "Webster",
"state": "NY",
"zipCode": "14580",
"country": "US",
"latitude": -1,
"longitude": -1
},
"taxes": 8.32,
"discount": 26,
"discountCode": "S20",
"giftCard": 0,
"giftCardNumber": "",
"billing": {
"label": "Test Customer",
"street": "1688 Lake Rd",
"city": "Webster",
"state": "NY",
"zipCode": "14580",
"country": "US"
},
"items": [
{
"id": 12316777,
"productId": 134607,
"quantity": 1,
"cost": 130,
"size": "9",
"width": "B",
"posId": "19f18f28-1fa9-4e69-a179-aadc0106402e",
"store": "1",
"name": "W Adrenaline GTS 20 CF S20",
"sku": "120296-1B-062",
"color": "EBONY/BLACK/HOLLYHOCK",
"brand": "Brooks",
"type": "product",
"taxes": 8.32
} ]
}
}
Fields Breakdown:
type: Defines the data type (
order
).action: Specifies the event (
created
), which triggers when a new order is placed.data: Contains customer, order details, shipping and billing addresses, and line items with details such as
quantity
,cost
, andsize
.
Use Case: Order creation webhooks can be used to initiate fulfillment workflows, update inventory, or calculate and log customer lifetime value.
Implementing Webhook Endpoints
Each webhook will call the endpoint you specify, and it’s essential to configure your endpoint to:
Validate Payloads: Ensure you’re receiving authentic data by verifying the payload’s signature if Run Free provides one.
Parse JSON: Convert the payload data into usable information for your application.
Handle Errors Gracefully: Log any errors and respond with appropriate HTTP status codes. For example, a
200 OK
status means successful processing.
Webhooks from the Run Free Project allow you to stay updated in real-time on customer actions, cart changes, and order placements, opening up opportunities for proactive marketing, inventory management, and personalized customer experiences. By using webhooks, your application or CRM system can seamlessly sync with Run Free Project data, enhancing operational efficiency and responsiveness.