TABLE OF CONTENTS
- Introduction
- Table of Contents
- Integration Flow Diagram
- 1. Requirements
- 2. Initial Setup
- 3. Live Shipping Rates Implementation
- 4. Order Syncing and Fulfillment
- 5. Disconnection and Uninstallation
- Conclusion
Introduction
This guide provides a comprehensive walkthrough for developing a shipping carrier integration with HighLevel's marketplace. A custom shipping carrier integration allows businesses using HighLevel to connect their preferred shipping providers, offer real-time shipping rates during checkout, automate order fulfillment workflows, and provide accurate tracking information directly to customers. This enhances the native e-commerce capabilities within HighLevel.
Key benefits of implementing a custom shipping carrier integration include:
- Flexibility: Connect with any shipping carrier that provides an API, beyond built-in options.
- Accurate Rates: Display real-time, accurate shipping costs from your specific carrier accounts during checkout.
- Automated Fulfillment: Reduce manual effort by automatically creating shipping labels and triggering shipments with your carrier.
- Seamless Tracking: Keep customers informed by syncing tracking information from the carrier back into HighLevel orders.
- Integrated Experience: Manage shipping aspects directly within the HighLevel ecosystem.
Building this integration involves backend development to handle API calls and webhooks, frontend development for user configuration (often via a Custom Page), and secure management of credentials and data flow between HighLevel, your service, and the carrier's API. By following this guide, you can build a robust integration that streamlines shipping operations for HighLevel users.
Integration Flow Diagram
1. Requirements
Technical Knowledge
- Basic backend development knowledge (e.g., Node.js, Python, etc.).
- Understanding of REST APIs, webhooks, and OAuth 2.0 authorization flow.
Backend Service
- A backend service capable of:
- Handling OAuth redirection from HighLevel.
- Receiving and processing webhooks from both HighLevel (e.g., order events) and the custom shipping carrier (e.g., shipping updates).
- Making API calls to both HighLevel and the custom carrier's API.
- Serving the frontend UI (if not hosted separately).
Database
- A database to securely store:
- HighLevel OAuth tokens (access and refresh tokens) associated with location IDs.
- Custom shipping carrier credentials (e.g., API keys, secrets) provided by the user, linked to the HighLevel location.
- Mapping information between HighLevel entities (like orders) and carrier entities.
Frontend
- A simple frontend application (can be implemented as a HighLevel Custom Page) that allows users to:
- Initiate the connection process.
- Input and save their shipping carrier API credentials.
- Manage connection settings (e.g., enable/disable features).
APIs
- Your backend service will need to implement several API endpoints:
- OAuth Redirect URI: Handles the callback from HighLevel after app authorization.
- HighLevel Webhook Listener: Receives webhooks from HighLevel (e.g.,
OrderCreate
,OrderStatusUpdate
). - Carrier Credential Management: APIs to save/update/delete carrier credentials entered via the frontend.
- Carrier Webhook Listener: Receives webhooks from the custom shipping carrier.
- Live Rates Callback: An endpoint HighLevel calls to fetch live shipping rates during checkout.
2. Initial Setup
Create Marketplace App
- Follow the HighLevel documentation to create a new Marketplace application: HighLevel Authorization Documentation
Configure App Settings
- App Type: Set the application type to Sub-Account. This allows installation on specific location accounts.
- Redirect URI: Set this to the URL of your backend service endpoint designated to handle the OAuth callback (e.g.,
https://your-backend.com/oauth/callback
). - Webhook URL: Set this to the URL of your backend service endpoint designated to receive webhooks from HighLevel (e.g.,
https://your-backend.com/webhooks/highlevel
). EnsureOrderCreate
andOrderStatusUpdate
webhooks are enabled in the app settings.
Required Scopes
- Your application will need the following scopes to manage shipping and orders. Refer to the scopes documentation for the exact scope names: HighLevel Scopes Documentation
orders.readonly
orders.write
shipping.readonly
shipping.write
Frontend UI (Custom Page)
- Develop a frontend interface where users can enter their specific shipping carrier credentials (API Key, Secret, Account ID, etc.).
- This UI should be embedded within HighLevel using a Custom Menu Link pointing to your hosted frontend page or an endpoint serving the UI.
Handling User Context
- Your frontend and backend need to identify the HighLevel location the user is currently interacting with. Use the context provided by HighLevel when loading your custom page/menu link.
- Refer to the documentation on User Context: User Context in Marketplace Apps
- Typically, this involves parsing a token (like a JWT or an encrypted payload) passed as a query parameter when HighLevel redirects to your frontend/backend. Decrypt/validate this token using a shared secret provided during app setup to get the
locationId
.
Backend Example (Node.js/Express):
Frontend Example (Custom Page JavaScript):
Carrier Credential Handling
Receive Credentials: Get the carrier API key, secret, etc., from the user via your frontend UI.
Associate with Location: Store these credentials securely in your database, linking them to the
locationId
obtained from the user context.Validate Credentials: Make a test API call to the carrier's API using the provided credentials to ensure they are valid. Provide feedback to the user.
Frontend Example (Saving Credentials):
Setup Carrier Webhooks: Use the validated carrier credentials to make API calls to the carrier's system to register your backend's carrier webhook listener URL (e.g.,
https://your-backend.com/webhooks/carrier
). This allows the carrier to notify your service about shipping updates (like tracking number generation).
3. Live Shipping Rates Implementation
To allow HighLevel checkout to display real-time shipping rates from your custom carrier, you need to register your service as a shipping carrier within HighLevel.
Register Shipping Carrier in HighLevel
- Your backend service needs to make a POST request to the HighLevel API endpoint responsible for creating shipping carriers. This endpoint is typically associated with the Store/Payments microservice. The endpoint is
POST /shipping-carrier
. - The request body should include the location context (
altId
,altType
) and details about your carrier integration.
Example Request:
name
: The name displayed to the user in HighLevel shipping settings.callbackUrl
: The base URL where HighLevel will send POST requests to fetch live rates during checkout. HighLevel will append/rates
to this URL. So, if you providehttps://your-backend.com/shipping
, HighLevel will callhttps://your-backend.com/shipping/rates
. In the example above, the final URL called will behttps://your-backend.com/rates/rates
, so adjust yourcallbackUrl
accordingly (e.g., justhttps://your-backend.com
if your endpoint is/rates
). Correction based on user prompt: The prompt implies the full URL including/rates
should be provided incallbackUrl
. Let's assume the prompt is correct: SetcallbackUrl
tohttps://your-backend.com/rates
.- Response: A successful response will contain the details of the created carrier, including a unique
_id
(let's call itshippingCarrierId
). Store thisshippingCarrierId
in your database, associated with the location and carrier credentials.
Implement Live Rates Callback
- Your backend must implement the endpoint specified in the
callbackUrl
(e.g.,POST /rates
). - HighLevel will send a
POST
request to this endpoint during checkout with details of the cart contents and destination address.
Example Request Body Received by Your Backend (POST /rates
):
- Your Backend Logic:
- Parse the request body.
- Retrieve the carrier credentials associated with the
altId
(locationId) from your database. - Transform the HighLevel rate request payload into the format required by your custom carrier's API.
- Call the carrier's API to get live shipping rates.
- Transform the carrier's response into the format expected by HighLevel.
- Example Response Sent by Your Backend:
Configure Shipping Rates in HighLevel Zones
After successfully registering the shipping carrier, your integration (or the user manually) needs to add shipping rates based on this carrier to the relevant Shipping Zones within HighLevel Store settings.
Backend Automation:
Use the HighLevel API to list existing Shipping Zones for the location. The endpoint is
GET /shipping-zone
.Example Request (
GET /shipping-zone
):For each relevant zone returned by the above call, use the HighLevel API to create a new Shipping Rate (
POST /shipping-zones/{zoneId}/rates
- endpoint inferred).- In the request body for creating the rate:
- Set
isCarrierRate
totrue
. - Provide the
shippingCarrierId
obtained during carrier registration. - Set a placeholder
amount
(e.g., 0) as the actual rate will be fetched live via the callback. - Set
name
(e.g., "My Awesome Shipping - Live Rates"). - Specify
altId
,altType
.
- Set
- In the request body for creating the rate:
Example Request Body (POST /shipping-zones/{zoneId}/rates
):
4. Order Syncing and Fulfillment
This section describes how to sync orders to your carrier and automate fulfillment updates back into HighLevel.
Enable Order Webhooks
- Ensure the
OrderCreate
andOrderStatusUpdate
webhooks are enabled in your HighLevel Marketplace App configuration settings. Point them to your backend's HighLevel webhook listener endpoint.
Handling Order Creation Webhook
Receive Webhook: Your backend receives a POST request from HighLevel when an order is created or its status changes (specifically looking for newly completed orders relevant for shipping).
Validate: Verify the webhook signature/authenticity if applicable.
Process:
- Check if the order status is appropriate for shipping (e.g.,
Completed
,Paid
). - Check if the order requires shipping (contains physical products).
- Retrieve the full order details using the HighLevel API (
GET /orders/{orderId}
). - Retrieve the associated carrier credentials from your database using the
locationId
.
- Check if the order status is appropriate for shipping (e.g.,
Backend Example (Node.js/Express):
Create Order with Carrier:
- Transform the HighLevel order data into the format required by your carrier's "create order" or "create shipment" API endpoint.
- Call the carrier's API to create the order/shipment.
- Store the mapping between the HighLevel
orderId
and the carrier's order/shipment ID in your database.
Handling Carrier Shipping Updates
Receive Webhook: Your backend's carrier webhook listener receives a notification from the shipping carrier when a shipment status changes (e.g., label printed, tracking number generated, shipped, delivered).
Validate: Verify the webhook's authenticity based on the carrier's mechanism (e.g., signature).
Process:
- Parse the webhook data to extract the carrier's order/shipment ID and the new shipping information (tracking number, tracking URL, status).
- Use the carrier ID to look up the corresponding HighLevel
orderId
andlocationId
from your database mapping.
Backend Example (Node.js/Express):
Create Fulfillment in HighLevel: If a tracking number is now available, trigger the fulfillment process in HighLevel.
- Use the HighLevel API to create an order fulfillment record. Refer to the official documentation: Create Order Fulfillment API
- This typically involves making a
POST
request to an endpoint like/orders/{orderId}/fulfillments
, as demonstrated in thecreateHighLevelFulfillment
function example above.
5. Disconnection and Uninstallation
When a user disconnects or uninstalls your Marketplace App from their location, you need to clean up the integration settings within HighLevel.
Deleting the Shipping Carrier
- Your backend should listen for the App Uninstalled webhook from HighLevel (configure this in your Marketplace App settings).
- When this webhook is received for a specific
locationId
:- Look up the
shippingCarrierId
associated with thatlocationId
in your database. - If found, make a
DELETE
request to the HighLevel API to remove the shipping carrier registration. The endpoint isDELETE /shipping-carrier/{shippingCarrierId}
.
- Look up the
Example Request:
- This removes the carrier from the location's shipping settings, preventing errors if the callback URL becomes invalid.
- Also, perform cleanup on your side: delete stored credentials, webhook registrations with the carrier, etc.
Conclusion
Successfully creating a custom shipping carrier integration for HighLevel can significantly enhance the platform's e-commerce capabilities for users, offering greater flexibility and automation in their shipping processes. This guide has outlined the essential steps, from setting up the Marketplace App and handling authentication to implementing live rates, order syncing, and fulfillment.
The core components involve:
- Secure Authentication: Managing OAuth tokens for HighLevel and API credentials for the carrier.
- API Integration: Interacting with both HighLevel and carrier APIs for registration, rates, orders, and fulfillment.
- Webhook Handling: Reliably processing asynchronous events from both platforms.
- Data Management: Storing credentials and mapping IDs between systems.
- User Interface: Providing a clear way for users to configure the integration.
When building your integration, remember to prioritize robust error handling, security best practices (especially around credentials), and clear logging for easier debugging. Consider the scalability of your backend service and database as usage grows. Keep abreast of API changes from both HighLevel and your target shipping carrier to ensure long-term compatibility.
By following these principles and adapting the examples provided, you can build a valuable and reliable shipping carrier integration for the HighLevel marketplace.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article