Integrating WooCommerce with Help Scout can be a game-changer for customer support. By automatically sending order details to your Help Scout helpdesk, you can provide more personalized and efficient support to your customers. In this blog post, we’ll walk you through setting up a WooCommerce webhook to send order information to Help Scout.
What Are Webhooks and Why Use Them?
Webhooks allow WooCommerce to send real-time data to other systems whenever specific events occur. By leveraging this functionality, you can ensure that customer order details are instantly available in Help Scout, making your support team better equipped to handle queries.
Prerequisites
Before getting started, ensure you have the following:
- WooCommerce Installed: Your WooCommerce store should be fully operational.
- Help Scout Account: Make sure you have an active Help Scout account.
- Help Scout API Key: This is required to authenticate requests.
- Admin Access: You’ll need access to your WordPress dashboard and Help Scout account.
Step 1: Set Up a Webhook in WooCommerce
- Log in to your WordPress admin dashboard.
- Navigate to WooCommerce > Settings > Advanced > Webhooks.
- Click Add Webhook to create a new webhook.
- Configure the webhook:
- Name: Give the webhook a descriptive name, such as “Send Order to Help Scout.”
- Status: Set to Active.
- Topic: Choose Order Created to trigger the webhook when a new order is placed.
- Delivery URL: Enter the URL of your middleware script or API endpoint that will process the webhook and send data to Help Scout.
- Secret: (Optional) Set a secret key for additional security.
- Click Save Webhook.
Step 2: Get Your Help Scout API Key
- Log in to your Help Scout account.
- Navigate to Manage > API Keys.
- Click Generate API Key.
- Copy the key and keep it secure—you’ll need it to authenticate requests.
Step 3: Create Middleware or Use a Pre-Built Integration
You’ll need a way to process WooCommerce webhook data and send it to Help Scout. You can either use a no-code platform like Zapier or write a custom script.
Option 1: Use a Pre-Built Integration
If you’re using a tool like Zapier:
- Log in to Zapier and create a new Zap.
- Select WooCommerce as the trigger app and use the Order Created event.
- Authenticate your WooCommerce account.
- Add Help Scout as the action app.
- Use the Create Conversation action to generate a new Help Scout conversation for each order.
- Map WooCommerce order fields (e.g., customer name, email, and order details) to Help Scout fields.
Option 2: Build a Custom Script
If you prefer a custom integration:
- Create a script to receive webhook data at the Delivery URL you configured earlier.
- Use the Help Scout API to create or update conversations with the order details.
Here’s a sample PHP script:
<?php
// Help Scout API Key
$api_key = 'YOUR_API_KEY';
$api_url = 'https://api.helpscout.net/v2/conversations';
// Function to handle WooCommerce webhook data
function handle_webhook($webhook_data) {
$order_id = $webhook_data['id'];
$customer_name = $webhook_data['billing']['first_name'] . ' ' . $webhook_data['billing']['last_name'];
$customer_email = $webhook_data['billing']['email'];
$order_total = $webhook_data['total'];
$order_items = $webhook_data['line_items'];
// Prepare Help Scout conversation data
$conversation = [
'type' => 'email',
'customer' => [
'email' => $customer_email
],
'subject' => "Order #$order_id",
'status' => 'active',
'mailboxId' => 'YOUR_MAILBOX_ID',
'threads' => [
[
'type' => 'customer',
'text' => "New order placed:\n\nOrder ID: $order_id\nCustomer: $customer_name\nTotal: $order_total\nItems:\n" . format_items($order_items)
]
]
];
// Send data to Help Scout
send_to_helpscout($conversation);
}
// Function to format order items
function format_items($items) {
$formatted = '';
foreach ($items as $item) {
$formatted .= "{$item['name']} (x{$item['quantity']}) - {$item['total']}\n";
}
return $formatted;
}
// Function to send data to Help Scout
function send_to_helpscout($data) {
global $api_url, $api_key;
$headers = [
'Authorization: Bearer ' . $api_key,
'Content-Type: application/json'
];
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Step 4: Test the Integration
- Place a test order in your WooCommerce store.
- Verify that the webhook triggers and sends the order data to your middleware or custom script.
- Log in to Help Scout and check for a new conversation with the order details.
Step 5: Monitor and Optimize
- Regularly check WooCommerce webhook logs to ensure data is being sent.
- Review Help Scout conversations to confirm accuracy.
- Adjust the middleware or script as needed to handle additional order details or updates.
Conclusion
By connecting WooCommerce to Help Scout using webhooks, you can automatically provide your support team with the context they need to assist customers effectively. Whether you use a no-code solution or write your own integration, this setup ensures seamless communication between your e-commerce and support systems.
Have questions or tips to share? Let us know in the comments!