### Important Note Before Enabling 2FA Source: https://docs.trackship.com/docs/trackship-account/account/2fa-authentication Before you begin the 2FA setup process, ensure you have a compatible authenticator app installed on your mobile device. This app is crucial for generating the verification codes needed for login. ```text **Important: Before starting the process, make sure you have an authenticator app like Google Authenticator or Authy installed on your mobile device** ``` -------------------------------- ### Example Response for Supported Shipping Carriers Source: https://docs.trackship.com/docs/tracking-api This is an example JSON response when requesting the list of supported shipping carriers. ```JSON { "success": true, "data": [ { "carrier_id": "fedex", "carrier_name": "FedEx", "tracking_url": "https://www.fedex.com/apps/fedextrack/?tracknumbers={{tracking_number}}" }, { "carrier_id": "ups", "carrier_name": "UPS", "tracking_url": "https://www.ups.com/track?tracknum={{tracking_number}}" } ] } ``` -------------------------------- ### CURL POST Request Example Source: https://docs.trackship.com/docs/tracking-api/get-a-shipment-status Example of how to make a POST request to the get shipment status endpoint using CURL. Includes necessary headers and a JSON payload with tracking details. ```curl curl --location 'https://api.trackship.com/v1/shipment/get/' \ --header 'trackship-api-key: ' \ --header 'app-name: ' \ --header 'Content-Type: application/json' \ --data '{ \ "tracking_number": "6860010537552", \ "tracking_provider": "delhivery" \ }' ``` -------------------------------- ### Example Tracking Page URL Source: https://docs.trackship.com/docs/trackship-for-woocommerce/setup/tracking-page Customers receive a link with the tracking number parameter to view their order status. This example shows the URL structure for a tracking number. ```url https://yourstore.com/ts-shipment-tracking/ ?tracking=123456789 ``` -------------------------------- ### Example API Response Source: https://docs.trackship.com/docs/tracking-api/get-all-shipping-providers This is an example of the JSON response body you will receive when successfully fetching all shipping providers. It includes a 'success' flag and a 'data' array containing provider labels and slugs. ```json { "success": true, "data": [ { "label": "Australia Post", "slug": "australia-post" }, { "label": "CouriersPlease", "slug": "couriersplease" }, ... ] } ``` -------------------------------- ### Example WhatsApp Message Template Source: https://docs.trackship.com/docs/trackship-for-woocommerce/setup/sms-notifications/whatsapp-business This is an example of a WhatsApp message template named 'trackship' for utility notifications. It includes placeholders for customer name, order ID, and shipment status, along with a call-to-action button. ```text Template Name: trackship Language: English (US) Category: Utility → Custom Template Body: ``` Hi {{billing_name}}, Your order no {{order_id}} is now {{shipment_status}}. Thanks Demo store ``` Variables: * {{billing_name}}: Billing Name * {{order_id}}: Order ID * {{shipment_status}}: Shipment Status (e.g., In transit, Delivered) Call-to-Action Button * Type: Visit website * Button Text: Track Order * URL Type: Dynamic * URL Format: `https://yourdomain.com/ts-shipment-tracking/?tracking={{1}}` ``` -------------------------------- ### API Response Body Example Source: https://docs.trackship.com/docs/cloud/create-a-shipment/add-shipments-via-api This is an example of a successful response from the TrackShip API after creating a shipment tracker. It indicates the status, a status message, remaining trackers balance, and the user's current plan. ```json { "status": "ok", "status_msg": "pending_trackship", "trackers_balance": "98", "user_plan": "Mini" } ``` -------------------------------- ### Successful Response Example Source: https://docs.trackship.com/docs/tracking-api/get-a-shipment-status-by-order-id This is a sample JSON response when the order ID is found and shipments are successfully retrieved. It includes details for each shipment associated with the order. ```json { "status": "success", "data": [ { "order_id": "141", "tracking_number": "463805514319", "tracking_provider": "fedex", "tracking_event_status": "delivered", "tracking_est_delivery_date": null, "origin_country": null, "destination_country": "IN", "shipping_service": "FEDEX_GROUND", "last_event_time": "2025-07-05 12:08:08", "events": [ { "message": "Shipment information sent to FedEx", "status": "pre_transit", "datetime": "2025-07-03 11:22:00", "source": "Fedex", "tracking_location": { "city": "", "state": "", "country": "", "zip": "L6S0C3" } }, { "message": "Delivered", "status": "delivered", "datetime": "2025-07-05 12:08:08", "source": "Fedex", "tracking_location": { "city": "Swan Lake", "state": "MB", "country": "", "zip": "R0G2S0" } } ] }, { "order_id": "141", "tracking_number": "463805514433", "tracking_provider": "fedex", "tracking_event_status": "delivered", "last_event_time": "2025-07-05 14:49:04", ... } ] } ``` -------------------------------- ### Successful Response Body Source: https://docs.trackship.com/docs/tracking-api/get-a-shipment-status Example of a successful response from the API, detailing shipment status, tracking information, and events. ```json { "status": "success", "data": { "order_id": "24", "tracking_number": "9212490276905104629392", "tracking_provider": "usps", "tracking_event_status": "in_transit", "tracking_est_delivery_date": null, "origin_country": null, "destination_country": "", "delivery_number": null, "delivery_provider": null, "shipping_service": "Priority Mail®", "last_event_time": "2023-02-09 10:38:00", "events": [ { "object": "TrackingDetail", "message": "Merchant Order Receipt Notification, USPS Awaiting Item - LOS ANGELES, CA", "description": "", "status": "pre_transit", "status_detail": "pre_transit", "datetime": "2023-02-09 04:13:00", "source": "USPS", "tracking_location": { "object": "TrackingLocation", "city": "LOS ANGELES", "state": "CA", "country": "", "zip": "90045" } }, { "object": "TrackingDetail", "message": "Picked Up by Shipping Partner, USPS Awaiting Item - LOS ANGELES, CA", "description": "", "status": "pre_transit", "status_detail": "pre_transit", "datetime": "2023-02-09 06:24:00", "source": "USPS", "tracking_location": { "object": "TrackingLocation", "city": "LOS ANGELES", "state": "CA", "country": "", "zip": "90045" } }, ... ], "destination_events": null } } ``` -------------------------------- ### Error Response Example - Order ID Not Found Source: https://docs.trackship.com/docs/tracking-api/get-a-shipment-status-by-order-id This is a sample JSON response when the specified order ID is not found in the system. It indicates an error and provides a descriptive message. ```json { "status": "error", "message": "Order ID not found" } ``` -------------------------------- ### Get All Shipping Providers (cURL) Source: https://docs.trackship.com/docs/tracking-api/get-all-shipping-providers Use this cURL command to make a GET request to the TrackShip API endpoint for retrieving all supported shipping carriers. No authentication is required for this endpoint. ```bash curl --location 'https://api.trackship.com/v1/shipping_carriers/supported' ``` -------------------------------- ### Get All Shipping Providers Source: https://docs.trackship.com/docs/tracking-api/get-all-shipping-providers Fetches a list of all shipping carriers supported by the TrackShip API. ```APIDOC ## GET /v1/shipping_carriers/supported ### Description Retrieves a list of all shipping carriers supported by the TrackShip API. ### Method GET ### Endpoint https://api.trackship.com/v1/shipping_carriers/supported ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (array) - An array of shipping provider objects. - **label** (string) - The display name of the shipping provider. - **slug** (string) - The unique identifier for the shipping provider. ### Response Example ```json { "success": true, "data": [ { "label": "Australia Post", "slug": "australia-post" }, { "label": "CouriersPlease", "slug": "couriersplease" }, ... ] } ``` ``` -------------------------------- ### Error Response Body Source: https://docs.trackship.com/docs/tracking-api/get-a-shipment-status Example of an error response from the API when tracking information is not found. ```json { "status": "error", "message": "tracking information is not exist" } ``` -------------------------------- ### Add Custom Order Status for Delivery Automation Source: https://docs.trackship.com/docs/trackship-for-woocommerce/how-to This example shows how to add a custom order status that is triggered when a shipment is marked as 'Delivered' by TrackShip. ```php add_action( 'trackship_after_shipment_delivered', 'trackship_set_custom_order_status_delivered' ); function trackship_set_custom_order_status_delivered( $shipment_id ) { $shipment = trackship_get_shipment( $shipment_id ); $order_id = $shipment->get_order_id(); $order = wc_get_order( $order_id ); // Set the custom order status $order->update_status( 'delivered' ); // Replace 'delivered' with your custom status slug } ``` -------------------------------- ### Configure Server-Side Cron Job for WordPress Source: https://docs.trackship.com/docs/trackship-for-woocommerce/how-to/configuration-wp-cron-from-server-side Use this command in your server's cron job configuration to execute WordPress's cron script. Ensure the path to your WordPress installation and the PHP executable are correct. ```bash cd ${HOME}/public_html; /usr/local/bin/php -q wp-cron.php ``` -------------------------------- ### Webhook Request Body Example Source: https://docs.trackship.com/docs/tracking-api/tracking-webhook This JSON object represents the data sent by TrackShip for a tracking event. It includes order details, tracking status, and a list of historical events. ```JSON { "user_key": "84cac6f02e418c3c8a3dc142fa3d2ef5", "order_id": "41086", "tracking_number": "9405511206203420254870", "tracking_provider": "usps", "tracking_event_status": "in_transit", "tracking_est_delivery_date": "2022-12-02 00:00:00", "tracking_destination_events": null, "origin_country": null, "destination_country": "US", "delivery_number": null, "delivery_provider": null, "shipping_service": "Priority Mail®", "last_event_time": "2022-11-29 21:40:00", "events": [ { "object": "TrackingDetail", "message": "Shipment Received, Package Acceptance Pending - MAGNA, UT", "description": "", "status": "pre_transit", "status_detail": "pre_transit", "datetime": "2022-11-29 16:52:00", "source": "USPS", "tracking_location": { "object": "TrackingLocation", "city": "MAGNA", "state": "UT", "country": "", "zip": "84044" } }, { "object": "TrackingDetail", "message": "Accepted at USPS Origin Facility - MAGNA, UT", "description": "", "status": "in_transit", "status_detail": "in_transit", "datetime": "2022-11-29 20:25:00", "source": "USPS", "tracking_location": { "object": "TrackingLocation", "city": "MAGNA", "state": "UT", "country": "", "zip": "84044" } }, { "object": "TrackingDetail", "message": "Arrived at USPS Regional Origin Facility - SALT LAKE CITY DISTRIBUTION CENTER, ", "description": "", "status": "in_transit", "status_detail": "in_transit", "datetime": "2022-11-29 21:40:00", "source": "USPS", "tracking_location": { "object": "TrackingLocation", "city": "SALT LAKE CITY DISTRIBUTION CENTER", "state": "", "country": "", "zip": "" } } ], "destination_events": null } ``` -------------------------------- ### Get Shipments by Order ID Source: https://docs.trackship.com/docs/tracking-api Retrieve tracking status for all shipments associated with a given order ID. This requires your API key for authentication. ```cURL curl --location 'https://api.trackship.com/v1/shipment/get_by_order_id/' \ --header 'trackship-api-key: ' ``` -------------------------------- ### Get shipments by order id Source: https://docs.trackship.com/docs/tracking-api Retrieves the tracking status of all shipments associated with a specific order ID. Requires an API key for authentication. ```APIDOC ## GET /v1/shipment/get_by_order ### Description Retrieves the tracking status of all shipments associated with a specific order ID. ### Method GET ### Endpoint https://api.trackship.com/v1/shipment/get_by_order ### Parameters #### Header Parameters - **trackship-api-key** (string) - Required - Your TrackShip API key. #### Query Parameters - **order_id** (string) - Required - The ID of the order. ``` -------------------------------- ### Get Shipments by Order ID Source: https://docs.trackship.com/docs/tracking-api/get-a-shipment-status-by-order-id This endpoint retrieves all shipment tracking statuses for a given Order ID. It requires authentication via `trackship-api-key` and `app-name` headers. ```APIDOC ## Get Shipments by Order ID ### Description This API endpoint allows you to retrieve the shipment tracking status of all shipments associated with a specific **Order ID**. ### Method POST ### Endpoint https://api.trackship.com/v1/shipment/by-order-id ### Headers - **trackship-api-key**: `` - **app-name**: `` - **Content-Type**: `application/json` ### Request Body - **order_id** (string) - Required - The ID of the order for which to retrieve shipment information. ### Request Example ```json { "order_id": "141" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation ('success' or 'error'). - **data** (array) - An array of shipment objects, each containing tracking details. - **order_id** (string) - The order ID associated with the shipment. - **tracking_number** (string) - The tracking number for the shipment. - **tracking_provider** (string) - The carrier providing the tracking service. - **tracking_event_status** (string) - The current status of the shipment (e.g., 'delivered'). - **tracking_est_delivery_date** (string|null) - Estimated delivery date. - **origin_country** (string|null) - Country of origin for the shipment. - **destination_country** (string|null) - Destination country for the shipment. - **shipping_service** (string) - The shipping service used. - **last_event_time** (string) - Timestamp of the last tracking event. - **events** (array) - A list of tracking events for the shipment. - **message** (string) - Description of the tracking event. - **status** (string) - Status of the event (e.g., 'delivered'). - **datetime** (string) - Timestamp of the event. - **source** (string) - The source of the tracking information. - **tracking_location** (object) - Location details for the event. - **city** (string) - City of the location. - **state** (string) - State or province of the location. - **country** (string) - Country of the location. - **zip** (string) - Zip or postal code. #### Error Response (e.g., 404 or 400) - **status** (string) - Indicates the failure of the operation ('error'). - **message** (string) - A message describing the error (e.g., 'Order ID not found'). ### Response Example (Success) ```json { "status": "success", "data": [ { "order_id": "141", "tracking_number": "463805514319", "tracking_provider": "fedex", "tracking_event_status": "delivered", "tracking_est_delivery_date": null, "origin_country": null, "destination_country": "IN", "shipping_service": "FEDEX_GROUND", "last_event_time": "2025-07-05 12:08:08", "events": [ { "message": "Shipment information sent to FedEx", "status": "pre_transit", "datetime": "2025-07-03 11:22:00", "source": "Fedex", "tracking_location": { "city": "", "state": "", "country": "", "zip": "L6S0C3" } }, { "message": "Delivered", "status": "delivered", "datetime": "2025-07-05 12:08:08", "source": "Fedex", "tracking_location": { "city": "Swan Lake", "state": "MB", "country": "", "zip": "R0G2S0" } } ] }, { "order_id": "141", "tracking_number": "463805514433", "tracking_provider": "fedex", "tracking_event_status": "delivered", "last_event_time": "2025-07-05 14:49:04", ... } ] } ``` ### Response Example (Error) ```json { "status": "error", "message": "Order ID not found" } ``` ``` -------------------------------- ### Get a shipment status Source: https://docs.trackship.com/docs/tracking-api Retrieves the current status of a shipment using its tracking number. Requires an API key for authentication. ```APIDOC ## GET /v1/shipment/get ### Description Retrieves the current status of a shipment. ### Method GET ### Endpoint https://api.trackship.com/v1/shipment/get ### Parameters #### Header Parameters - **trackship-api-key** (string) - Required - Your TrackShip API key. #### Query Parameters - **tracking_number** (string) - Required - The tracking number of the shipment. ``` -------------------------------- ### Cloudflare WAF Custom Rule Expression Source: https://docs.trackship.com/docs/trackship-for-woocommerce/how-to/whitelist-trackship-ips This is an example of a WAF custom rule expression to whitelist a specific TrackShip IP address. Use this when manually creating a custom rule in Cloudflare. ```cloudflare-waf (ip.src eq 2605:7380:8000:1000:986a:b6ff:fe1f:688f) ``` -------------------------------- ### Send Shipment Status Email Notifications to Admin Source: https://docs.trackship.com/docs/trackship-for-woocommerce/how-to Configure TrackShip for WooCommerce to automatically notify customers about shipment status changes. This snippet focuses on the setup for admin notifications. ```php # This functionality is typically configured within the TrackShip plugin settings. # No direct code snippet is usually required here, but you can use hooks for customization. # Example hook to customize email content (if needed): # add_filter( 'trackship_email_content', 'trackship_customize_admin_email_content', 10, 4 ); # function trackship_customize_admin_email_content( $content, $email_type, $shipment_id, $customer_id ) { # // Customize $content based on $email_type (e.g., 'shipped', 'delivered') # if ( $email_type === 'delivered' ) { # $content .= '

Additional admin note.

'; # } # return $content; # } # Ensure 'Admin Notifications' are enabled in TrackShip settings for relevant events. ``` -------------------------------- ### Get Shipment Status Source: https://docs.trackship.com/docs/tracking-api/get-a-shipment-status This endpoint allows you to retrieve the current status of a shipment by providing the tracking number and provider. It requires specific API key and app name headers for authentication and identification. ```APIDOC ## POST /v1/shipment/get/ ### Description Retrieves the current status of a shipment. ### Method POST ### Endpoint https://api.trackship.com/v1/shipment/get/ ### Headers - **trackship-api-key** (string) - Required - Your TrackShip API key. - **app-name** (string) - Required - The name of your application. ### Request Body - **tracking_number** (string) - Required - The tracking number of the shipment. - **tracking_provider** (string) - Required - The provider of the tracking service (e.g., "delhivery", "usps"). ### Request Example ```json { "tracking_number": "6860010537552", "tracking_provider": "delhivery" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the request (e.g., "success"). - **data** (object) - Contains shipment details if the request is successful. - **order_id** (string) - The order ID associated with the shipment. - **tracking_number** (string) - The tracking number. - **tracking_provider** (string) - The tracking provider. - **tracking_event_status** (string) - The current status of the shipment (e.g., "in_transit"). - **tracking_est_delivery_date** (string or null) - Estimated delivery date. - **origin_country** (string or null) - Origin country of the shipment. - **destination_country** (string) - Destination country of the shipment. - **delivery_number** (string or null) - Delivery number. - **delivery_provider** (string or null) - Delivery provider. - **shipping_service** (string) - The shipping service used. - **last_event_time** (string) - Timestamp of the last tracking event. - **events** (array) - An array of tracking events. - **object** (string) - Type of the tracking event object. - **message** (string) - Description of the tracking event. - **description** (string) - Additional description for the event. - **status** (string) - Status of the event (e.g., "pre_transit"). - **status_detail** (string) - Detailed status of the event. - **datetime** (string) - Timestamp of the event. - **source** (string) - Source of the tracking information. - **tracking_location** (object) - Location details for the tracking event. - **object** (string) - Type of the tracking location object. - **city** (string) - City of the location. - **state** (string) - State of the location. - **country** (string) - Country of the location. - **zip** (string) - Zip code of the location. - **destination_events** (string or null) - Details about destination events. #### Error Response (e.g., 400 or other) - **status** (string) - Indicates the status of the request (e.g., "error"). - **message** (string) - A message describing the error (e.g., "tracking information is not exist"). ### Response Example (Success) ```json { "status": "success", "data": { "order_id": "24", "tracking_number": "9212490276905104629392", "tracking_provider": "usps", "tracking_event_status": "in_transit", "tracking_est_delivery_date": null, "origin_country": null, "destination_country": "", "delivery_number": null, "delivery_provider": null, "shipping_service": "Priority Mail®", "last_event_time": "2023-02-09 10:38:00", "events": [ { "object": "TrackingDetail", "message": "Merchant Order Receipt Notification, USPS Awaiting Item - LOS ANGELES, CA", "description": "", "status": "pre_transit", "status_detail": "pre_transit", "datetime": "2023-02-09 04:13:00", "source": "USPS", "tracking_location": { "object": "TrackingLocation", "city": "LOS ANGELES", "state": "CA", "country": "", "zip": "90045" } }, { "object": "TrackingDetail", "message": "Picked Up by Shipping Partner, USPS Awaiting Item - LOS ANGELES, CA", "description": "", "status": "pre_transit", "status_detail": "pre_transit", "datetime": "2023-02-09 06:24:00", "source": "USPS", "tracking_location": { "object": "TrackingLocation", "city": "LOS ANGELES", "state": "CA", "country": "", "zip": "90045" } } ], "destination_events": null } } ``` ### Response Example (Error) ```json { "status": "error", "message": "tracking information is not exist" } ``` ``` -------------------------------- ### Get Shipments by Order ID - CURL Request Source: https://docs.trackship.com/docs/tracking-api/get-a-shipment-status-by-order-id Use this CURL command to send a POST request to the TrackShip API to retrieve shipment status for a given order ID. Ensure you replace placeholder values with your actual API key and app name. ```bash curl --location 'https://api.trackship.com/v1/shipment/by-order-id' \ --header 'trackship-api-key: d240823f202cbaa2eb854a752066178f' \ --header 'app-name: \ --header 'Content-Type: application/json' \ --data '{ \ "order_id": "141" \ }' ``` -------------------------------- ### Create a tracking Source: https://docs.trackship.com/docs/tracking-api Creates a shipment tracker for a custom application. Requires an API key and app name for authentication. ```APIDOC ## POST /v1/shipment/create ### Description Creates a shipment tracker for a custom application. ### Method POST ### Endpoint https://api.trackship.com/v1/shipment/create ### Parameters #### Header Parameters - **trackship-api-key** (string) - Required - Your TrackShip API key. - **app-name** (string) - Required - The name of your custom application. ``` -------------------------------- ### Create Shipment Source: https://docs.trackship.com/docs/tracking-api/create-shipment This endpoint creates a shipment tracker for a custom app. It requires API key and app name in the header, and shipment details in the request body. ```APIDOC ## POST https://api.trackship.com/v1/shipment/create/ ### Description Creates a shipment tracker for a custom app. ### Method POST ### Endpoint https://api.trackship.com/v1/shipment/create/ ### Header Parameters - **trackship-api-key** (string) - Required - Your TrackShip API key. - **app-name** (string) - Required - The name of your application. ### Request Body - **tracking_number** (string) - Required - The tracking number for the shipment. - **tracking_provider** (string) - Required - The provider of the tracking service (e.g., 'ups'). - **order_id** (string) - Optional - The order ID associated with the shipment. - **postal_code** (string) - Optional - The postal code of the destination. - **destination_country** (string) - Optional - The destination country code (e.g., 'US'). ### Request Example ```json { "tracking_number": "1Z4937W56728755212", "tracking_provider": "ups", "order_id": "13", "postal_code": "98012", "destination_country": "US" } ``` ### Response #### Success Response (200) - **status** (string) - The status of the operation (e.g., 'ok'). - **status_msg** (string) - A message describing the status (e.g., 'pending_trackship'). - **trackers_balance** (string) - The remaining trackers balance for the user. - **user_plan** (string) - The current user plan. #### Response Example ```json { "status": "ok", "status_msg": "pending_trackship", "trackers_balance": "98", "user_plan": "Mini" } ``` ``` -------------------------------- ### Get Shipment Status Source: https://docs.trackship.com/docs/tracking-api Retrieve the current status of a specific shipment using its tracking details. Authentication via API key is required. ```cURL curl --location 'https://api.trackship.com/v1/shipment/get/' \ --header 'trackship-api-key: ' ``` -------------------------------- ### Create Shipment via API Source: https://docs.trackship.com/docs/cloud/create-a-shipment Use this endpoint to create a shipment tracker via the TrackShip Cloud API. Ensure you include your API key and app name in the header. ```bash POST https://api.trackship.com/v1/shipment/create/ Header Parameter: trackship-api-key : app-name : ... ``` -------------------------------- ### Create Shipment Tracker Source: https://docs.trackship.com/docs/tracking-api Use this endpoint to create a shipment tracker for your custom application. Ensure you include the necessary header parameters for authentication and app identification. ```cURL curl --location 'https://api.trackship.com/v1/shipment/create/' \ --header 'trackship-api-key: ' \ --header 'app-name: ' ``` -------------------------------- ### Error Response for Missing App Name Source: https://docs.trackship.com/docs/tracking-api/delete-a-shipment-tracker This JSON object represents an error response when the 'app-name' header is not found or invalid. ```json { "status": "error", "message": "app name not found" } ``` -------------------------------- ### POST /webhook/ Source: https://docs.trackship.com/docs/tracking-api/tracking-webhook Receives tracking updates from TrackShip via a POST request to your specified webhook URL. ```APIDOC ## POST /webhook/ ### Description This endpoint receives tracking updates from TrackShip. It is secured using HTTPS and requires an API key in the headers for authentication. A 200 response code indicates successful receipt; otherwise, TrackShip will retry in 2 hours. ### Method POST ### Endpoint https://demostore.com/webhook/ ### Headers - **trackship-api-key** (string) - Required - Your unique API key for authentication. - **Content-type** (string) - Required - Should be set to "application/json". - **accept** (string) - Required - Should be set to "application/json". ### Request Body Contains detailed tracking information for an order. ```json { "user_key": "84cac6f02e418c3c8a3dc142fa3d2ef5", "order_id": "41086", "tracking_number": "9405511206203420254870", "tracking_provider": "usps", "tracking_event_status": "in_transit", "tracking_est_delivery_date": "2022-12-02 00:00:00", "tracking_destination_events": null, "origin_country": null, "destination_country": "US", "delivery_number": null, "delivery_provider": null, "shipping_service": "Priority Mail®", "last_event_time": "2022-11-29 21:40:00", "events": [ { "object": "TrackingDetail", "message": "Shipment Received, Package Acceptance Pending - MAGNA, UT", "description": "", "status": "pre_transit", "status_detail": "pre_transit", "datetime": "2022-11-29 16:52:00", "source": "USPS", "tracking_location": { "object": "TrackingLocation", "city": "MAGNA", "state": "UT", "country": "", "zip": "84044" } }, { "object": "TrackingDetail", "message": "Accepted at USPS Origin Facility - MAGNA, UT", "description": "", "status": "in_transit", "status_detail": "in_transit", "datetime": "2022-11-29 20:25:00", "source": "USPS", "tracking_location": { "object": "TrackingLocation", "city": "MAGNA", "state": "UT", "country": "", "zip": "84044" } }, { "object": "TrackingDetail", "message": "Arrived at USPS Regional Origin Facility - SALT LAKE CITY DISTRIBUTION CENTER, ", "description": "", "status": "in_transit", "status_detail": "in_transit", "datetime": "2022-11-29 21:40:00", "source": "USPS", "tracking_location": { "object": "TrackingLocation", "city": "SALT LAKE CITY DISTRIBUTION CENTER", "state": "", "country": "", "zip": "" } } ], "destination_events": null } ``` ### Response #### Success Response (200) Indicates that the webhook data was received successfully. #### Response Example (No specific response body is detailed in the source, but a 200 status code is expected for success.) ``` -------------------------------- ### Configure WP Cron for TrackShip Source: https://docs.trackship.com/docs/trackship-for-woocommerce/how-to Configure WP Cron to create trackers and send shipment status email/SMS notifications through TrackShip. ```php # Ensure WP Cron is enabled and running # Add the following to your theme's functions.php or a custom plugin: // This is a conceptual example. Actual WP Cron configuration might involve server-level settings or plugins. // The following hook might be used by TrackShip internally or for custom scheduling. // add_action( 'wp_cron_scheduled_trackers', 'trackship_schedule_trackers' ); // function trackship_schedule_trackers() { // // Logic to schedule tracker creation // } // For sending notifications, ensure TrackShip's notification settings are configured correctly. // This snippet is more of a configuration note than direct code. // To ensure WP Cron runs, you might need to disable the default WordPress cron and use server cron. // Example using a plugin like 'WP Crontrol' or server-level cron jobs. // Example of checking if WP Cron is disabled and suggesting alternatives: // if ( ! defined( 'DISABLE_WP_CRON' ) || ! DISABLE_WP_CRON ) { // // WP Cron is enabled, ensure it's running frequently enough // } else { // // WP Cron is disabled, use server cron to hit wp-cron.php // } ``` -------------------------------- ### API Request Authentication Headers Source: https://docs.trackship.com/docs/tracking-api/api-requests-authentication Include these headers in all API calls to authenticate your requests. Replace placeholders with your actual API key and app name. ```http trackship-api-key: API_KEY_HERE app-name: APP_NAME Content-Type: application/json ``` -------------------------------- ### API Headers Source: https://docs.trackship.com/docs/tracking-api/get-a-shipment-status Required headers for authenticating and identifying your application when making API requests. ```http trackship-api-key: app-name: ``` -------------------------------- ### Enable HTTP Authorization Header in .htaccess Source: https://docs.trackship.com/docs/resources/faq Add this to your .htaccess file if your shared host has disabled the HTTP Authorization Header. This is often necessary for external requests to function correctly. ```apache RewriteEngine on RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1] ``` -------------------------------- ### API Authentication Headers Source: https://docs.trackship.com/docs/tracking-api/api-requests-authentication All API calls must include the `trackship-api-key` and `app-name` headers for authentication. The `Content-Type` header should also be set to `application/json`. ```APIDOC ## API Authentication Headers ### Description All API calls must include the `trackship-api-key` and `app-name` headers for authentication. The `Content-Type` header should also be set to `application/json`. ### Headers - **trackship-api-key**: Your unique API key. Replace **API_KEY_HERE** with your actual API key. - **app-name**: The name of your application. Replace **APP_NAME** with your actual app name. - **Content-Type**: Must be set to `application/json`. ### How to find your API Key Navigate to Account Setting > API Key, you can copy your key to the clipboard by clicking the copy your API Key. The API Key will be used to authenticate you when you use the Tracking API and in the webhook. ### How to find your APP name Navigate to the Stores > settings > Webhook, you will find the APP name there. Use that for API calls ``` -------------------------------- ### API Request Headers Source: https://docs.trackship.com/docs/cloud/create-a-shipment/add-shipments-via-api These are the required header parameters for authenticating and identifying your application when making API requests. ```http trackship-api-key : app-name : ``` -------------------------------- ### Add Shipment Source: https://docs.trackship.com/docs/cloud/create-a-shipment/add-shipments-via-api This endpoint allows you to create a shipment tracker by providing shipment details in the request body. ```APIDOC ## POST https://api.trackship.com/v1/shipment/create/ ### Description Creates a shipment tracker for a given shipment. ### Method POST ### Endpoint https://api.trackship.com/v1/shipment/create/ ### Header Parameters - **trackship-api-key** (string) - Required - Your TrackShip API key. - **app-name** (string) - Required - The name of your application. ### Request Body - **tracking_number** (string) - Required - Tracking number for the package. - **tracking_provider** (string) - Required - Unique code of the tracking provider. - **order_id** (string) - Required - Respective order ID. - **postal_code** (string) - Optional - The postal code of the receiver’s address. - **destination_country** (string) - Optional - Destination country for receiver’s address. - **customer_name** (string) - Optional - The name of the customer. - **customer_email** (string) - Optional - The email address of the customer, with CC option via comma separation. - **customer_phone** (string) - Optional - The phone number of the customer. - **shipping_address_1** (string) - Optional - The first line of the shipping address. - **shipping_address_2** (string) - Optional - The second line of the shipping address. - **shipping_city** (string) - Optional - The city of the shipping address. - **shipping_state** (string) - Optional - The state or region of the shipping address. - **shipping_country** (string) - Optional - The country code of the shipping address. - **shipment_items** (array of objects) - Optional - An array of objects representing the items in the shipment. Each object should contain a `name` attribute specifying the name of the item. ### Request Example ```json { "tracking_number": "D84555920", "tracking_provider": "dtdc", "order_id": "025", "postal_code": "123456", "destination_country": "US", "customer_name": "John", "customer_email": "John@gmail.com,exmple@gmail.com", "customer_phone": "5522552255", "shipping_address_1": "13 Main Street", "shipping_address_2": "Apt 101", "shipping_city": "Anytown", "shipping_state": "Example State", "shipment_items": [ { "name": "Men T-shirt", "qty": "1", "image_url": "https://placeholder.com/images/product-1.jpg", "product_url": "https://placeholder.com/product/product-1/" }, { "name": "Men Pents", "qty": "2", "image_url": "https://placeholder.com/images/product-2.jpg", "product_url": "https://placeholder.com/product/product-2/" } ] } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation (e.g., "ok"). - **status_msg** (string) - A message describing the status (e.g., "pending_trackship"). - **trackers_balance** (string) - The remaining trackers balance. - **user_plan** (string) - The user's current plan. #### Response Example ```json { "status": "ok", "status_msg": "pending_trackship", "trackers_balance": "98", "user_plan": "Mini" } ``` ``` -------------------------------- ### Whitelist TrackShip IPs for Cloudflare WAF Source: https://docs.trackship.com/docs/trackship-for-woocommerce/how-to If TrackShip requests are blocked by Cloudflare's WAF, whitelist TrackShip's IP addresses to resolve the issue. This is a configuration step, not a code snippet. ```text # Add the following IP addresses to your Cloudflare firewall allowlist: # 173.245.48.0/20 # 103.21.244.0/22 # 103.22.200.0/22 # 103.31.56.0/22 # 141.101.64.0/18 # 108.162.192.0/18 # 55.148.128.0/17 # 172.64.0.0/13 # 131.0.80.0/20 # 190.93.240.0/20 # 185.199.108.0/22 # 197.235.24.0/22 # 198.41.192.0/18 # 162.158.0.0/15 # 104.16.0.0/13 # 104.24.0.0/14 # 173.245.192.0/18 # 103.21.244.0/22 # 103.22.200.0/22 # 103.31.56.0/22 # 141.101.64.0/18 # 108.162.192.0/18 # 55.148.128.0/17 # 172.64.0.0/13 # 131.0.80.0/20 # 190.93.240.0/20 # 185.199.108.0/22 # 197.235.24.0/22 # 198.41.192.0/18 # 162.158.0.0/15 # 104.16.0.0/13 # 104.24.0.0/14 # 173.245.192.0/18 # Consult TrackShip documentation for the most up-to-date IP list. ``` -------------------------------- ### Replace Text in Tracking Events (PHP) Source: https://docs.trackship.com/docs/trackship-for-woocommerce/how-to/replace-texts-from-the-tracking-events Use this PHP code snippet to replace specific words in tracking event descriptions. Add the text to find in the $find array and its replacement in the $replace array. This is useful for hiding or altering information shown to customers on the tracking widget. ```php add_filter( 'trackship_tracking_event', 'replace_text_tracking_event', 10, 1 ); /** * Replaces specified text in the tracking event. * * @param string $tracking_event The tracking event * * @return string The modified tracking event */ function replace_text_tracking_event ( $tracking_event ) { // Add words to be replaced in the $find array, and their corresponding replacements in the $replace array. $find = array( "China", ); $replace = array( "Asia", ); $tracking_event = str_replace( $find, $replace, $tracking_event ); return $tracking_event; } ``` -------------------------------- ### Allowing External HTTP Requests in .htaccess Source: https://docs.trackship.com/docs/trackship-for-woocommerce/getting-started/connect-your-store Add this code to your .htaccess file to ensure external HTTP requests, particularly write requests for TrackShip, are not blocked by server configurations or security plugins. This is crucial for resolving 'Forbidden' errors. ```apache RewriteEngine on RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1] ``` -------------------------------- ### Track Order Shortcode Source: https://docs.trackship.com/docs/trackship-for-woocommerce/setup/tracking-page Use this shortcode on your WordPress page to display the TrackShip tracking widget. Ensure this shortcode is added to the page content if you select a custom page as your tracking page. ```shortcode [trackship-track-order] ``` -------------------------------- ### Add WhatsApp Template Details in TrackShip Source: https://docs.trackship.com/docs/trackship-for-woocommerce/setup/sms-notifications/whatsapp-business Configure your approved WhatsApp template details within TrackShip's SMS Notification settings. Ensure the Template ID, Variables, and Language match your Meta configuration precisely. ```text Template ID: trackship Template Variables: {billing_name}, {order_id}, {shipment_status} Template Language: en_us ``` -------------------------------- ### Add Custom Order Statuses for Delivery Automation Source: https://docs.trackship.com/docs/trackship-for-woocommerce/how-to/how-to-add-custom-order-statuses-for-delivery-automation This PHP snippet registers custom order statuses to trigger the 'Delivered' shipment status in WooCommerce. Add this to your theme's functions.php file or a code snippets plugin. ```php /* * add order status to trigger delivered status */ add_filter( 'allowed_order_status_for_delivered', 'allow_status_for_delivery_automation' ); function allow_status_for_delivery_automation( $order_statuses ) { $order_statuses[] = 'in_transit'; $order_statuses[] = 'packed'; $order_statuses[] = 'delivering'; //You can add your custom order statuses like this for delivery automation. return $order_statuses; } ``` -------------------------------- ### Rename Tracking Widget Tab Labels Source: https://docs.trackship.com/docs/trackship-for-woocommerce/how-to Modify the label name of the 'Tracking progress' tab on your tracking page by including this code snippet. ```php add_filter( 'trackship_tracking_page_tabs', 'trackship_rename_tracking_tab_label' ); function trackship_rename_tracking_tab_label( $tabs ) { // Rename the 'Tracking Progress' tab to 'Shipment Details' if ( isset( $tabs['tracking_progress'] ) ) { $tabs['tracking_progress']['title'] = __( 'Shipment Details', 'trackship' ); } return $tabs; } ```