> For the complete documentation index, see [llms.txt](https://help.tacinsight.com/fast-weigh-knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.tacinsight.com/fast-weigh-knowledge-base/references/integrations/haulhub.md).

# HaulHub

{% hint style="info" %}
For assistance in building the Haul Hub Integration, contact us at 865-219-2980 or [support@tacinsight.com](mailto:mailto:support@tacinsight.com)
{% endhint %}

{% hint style="info" %}
Note: You will need access to the [API Module](https://tacinsight.zohodesk.com/portal/en/kb/articles/149-api-overview) in order to build this integration!
{% endhint %}

## Enabling the Haul Hub Integration

* Navigate to Admin Settings (Gear Icon) > API Info
* Click on the "Show" button to access the Webhooks Dashboard.
* Click the "+ Add Endpoint" button to build the webhook.
* In the Message Filtering options, select `ticket.created`, `ticket.updated`, and `ticket.voided`.
* Build the Endpoint URL following this layout:

{% code overflow="wrap" %}

```
https://haulhub.fastweigh.workers.dev/send?FW_GRAPHQL_SERVER=FWT&FW_API_KEY=<insert_fast-weigh_api_key_here>&HH_API_KEY=<insert_haulhub_api_key_here>
```

{% endcode %}

* You can find your API Key and GraphQL server (the first part of the GraphQL Endpoint URL) on the API Info Page.
* It should look something  like this when you are finished:

{% code overflow="wrap" %}

```
https://haulhub.fastweigh.workers.dev/send?FW_GRAPHQL_SERVER=FWT&FW_API_KEY=11111-11111-1111-11111&HH_API_KEY=2222222-22222-22222-22222
```

{% endcode %}

* Hit the Create button to create the new webhook.
* Check the "Certified" checkbox on any order that you want tickets to flow to HaulHub.

{% hint style="warning" %}

#### Customizing Payload

\- The following query parameters can optionally be appended to the webhook URL to modify the payload sent to HaulHub (e.g. `<webhook URL>&DOT_CODE=OrderUDF1`):

\
&#x20; \- `&TOTALS_BY=`: Selects how to calculate both `loads_today` and `quantity_shipped_today`.\
&#x20;   \- `Request`: Includes tickets on the same request across dates and order products. If the ticket has no request (a missing, null, or zero request key), falls back to the same order product and ticket date.\
&#x20;   \- `Order`: Includes all tickets on the same order and ticket date, across order products, regardless of whether the ticket has a request.\
&#x20;   \- Totals exclude voided tickets and only include ticket keys less than or equal to the current ticket's key, including when an older ticket is updated or resent.\
&#x20;   \- If omitted or set to an unrecognized value, retains the default totals for the same order product and ticket date. The values `Request` and `Order` are case-sensitive.

\
&#x20; \- `&DOT_CODE=`: Can be given the value of one of the following \_(e.g. `&DOT_CODE=OrderUDF2`)\_\
&#x20;   \- `OrderUDFX` where `X` is a number between 1 and 10\
&#x20;   \- `DOT_CODE` can also be hard coded into the webhook URL `<webhook URL>&DOT_CODE=01023436C3A3FABCD`\
&#x20;   \- If set, the `dot_code` of the payload will use the assigned Order UDF field. If NOT set, the `dot_code` will be blank

\
&#x20; \- `&JOB_NUMBER=`: Can be given the value of one of the following \_(e.g. `JOB_NUMBER=OrderUDF3`)\_\
&#x20;   \- `OrderUDFX` where `X` is a number between 1 and 10\
&#x20;   \- If set, the `job_number` of the payload will use the assigned Order UDF field. If NOT set, the `job_number` will use the Ticket's `Job` field, or if that is blank, the Order's `DefaultJob` field

\
&#x20; \- `&MATERIAL_NUMBER=`: Can be given the value of one of the following \_(e.g. `MATERIAL_NUMBER=OrderUDF1`)\_\
&#x20;   \- `DOTName` | `PricingDescription` | `OrderUDFX` where `X` is a number between 1 and 10\
&#x20;   \- If set to an OrderUDF, the `material_number` of the payload will use the assigned Order UDF field. If set to DOTName, the `material_number` of the payload will use the Product's `DOTName` field. If set to PricingDescription, the `material_number` of the payload will use the OrderProduct's `Description` field (the Product Pricing Description in Fast-Weigh). If NOT set, the `material_number` will use the Product's `ProductID` field

\
&#x20; \- `&PRODUCT_CODE=`: Can be given the value of one of the follow \_(e.g. `PRODUCT_CODE=DOTName`)\_\
&#x20;   \- `DOTName` | `PricingDescription`\
&#x20;   \- If set to DOTName, the `product_code` of the payload will use the Product's `DOTName` field. If set to PricingDescription, the `product_code` of the payload will use the OrderProduct's `Description` field (the Product Pricing Description in Fast-Weigh). If NOT set, the `product_code` will use the Product's `ProductID` field

\
&#x20; \- `&MAX_GVW=`: Can be given the value of one of the following \_(e.g. `MAX_GVW=TicketUDF2`)\_\
&#x20;   \- `TicketUDFX` where `X` is a number between 1 and 10\
&#x20;   \- If set, the `max_gvw` of the payload will use the assigned Ticket UDF field. If NOT set, the `max_gvw` will use the Truck's `WeightCapacity` if it exists, else it will be blank

\
&#x20; \- `&JOB=`: Can be given the value of `OrderDeliveryLocation`\
&#x20;   \- If set, the `job` of the payload will use the Delivery Location of the Order. If NOT set, the `job` will use the Order's `Description` field

\
&#x20; \- `&CONTRACT_NUMBER`: Can be given the value of one of the following \_(e.g. `CONTRACT_NUMBER=OrderUDF2`)\_\
&#x20;   \- `OrderUDFX` where `X` is a number between 1 and 10\
&#x20;   \- If set to an OrderUDF, the `contract_number` of the payload will use the assigned Order UDF field. If NOT set, the `contract_number` will use Order's `PONumber` field (the default PO Number set on an Order)

\
&#x20; \- `&SUPPLIER_CODE=`: Can be given the value of one of the following \_(e.g. `SUPPLIER_CODE=YardUDF4`)\_\
&#x20;   \- `YardUDFX` where `X` is a number between 1 and 10\
&#x20;   \- If set, the `supplier_code` of the payload will use the assigned Yard UDF field. If NOT set, the `supplier_code` will use the Yard's `WarehouseCode` field, or if that is blank, the Yard's Region `RegionName` field
{% endhint %}

{% hint style="danger" %}
Some DOTs require a **Agency Code**.  This value will be provided by Haul Hub if applicable and is typically mapped to the DOT\_CODE field.
{% endhint %}

## Haulhub Javascript Payload

{% code overflow="wrap" lineNumbers="true" %}

```javascript
slip_number: ticket.TicketNumber,
dot_code: DOT_CODE ?? '',
dispatched_at: formattedDateTime,
last_updated: formattedDateTime,
timestamp: formattedDateTime,
gross_amount: ticket.GrossWeight,
tare_amount: ticket.TareWeight,
net_amount: ticket.NetWeight,
quantity_uom_code: 'ton',
gross2_amount: ticket.GrossWeight! * 2000,
tare2_amount: ticket.TareWeight! * 2000,
net2_amount: ticket.NetWeight * 2000,
uom2: 'lbs',
client_id: ticket.Order.Customer.CustomerID,
client_name: ticket.Order.Customer.CustomerName,
comments: ticket.Note,
contract_number: ticket.Order.PONumber,
customer_name: ticket.Order.Customer.CustomerName,
deputy: ticket.Operator,
dispatch_number: ticket.TicketNumber,
job: ticket.Order.Description,
job_number: ticket.Job ? ticket.Job : ticket.Order.DefaultJob,
line_item_description: ticket.OrderProduct?.Product.ProductDescription,
line_item_quantity: ticket.NetWeight,
loads_today: totalTickets,
material_number: ticket.OrderProduct?.Product.ProductID,
phase_code: ticket.Phase,
plant_id: ticket.OrderProduct?.Yard.YardName,
plant_name: ticket.OrderProduct?.Yard.YardDescription,
product_code: ticket.OrderProduct?.Product.ProductID,
purchase_order_number: ticket.Order.PONumber,
quantity_shipped_today: totalNetWeight,
supplier: ticket.OrderProduct?.Yard.Location.Region.RemitName,
supplier_code: ticket.OrderProduct?.Yard.WarehouseCode ?? ticket.OrderProduct?.Yard.Location.Region.RegionName,
tonnage: ticket.NetWeight,
void: ticket.Void,
weighmaster: ticket.Operator,
fleet_id: ticket.Truck.Hauler.HaulerID,
fleet_name: ticket.Truck.Hauler.HaulerName,
truck_id: ticket.Truck.TruckID,
license_1: ticket.Truck.LicenseNum,
audit_log: [],
```

{% endcode %}
