> For the complete documentation index, see [llms.txt](https://docs.edgetag.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.edgetag.io/channels/webhook/templates/hubspot-contact-and-deal.md).

# HubSpot - Contact & Deal

### **HubSpot Configuration**

1. **Create a Private App**
   * In HubSpot: *Settings → Account Settings → Integrations → Private Apps*, click **Create Private App**.
   * Under **Basic Info**, name it `EdgeTagConnector`.
   * Under **Scopes**, select:
     * `crm.objects.contacts.read`
     * `crm.objects.contacts.write`
     * `crm.objects.deals.read`
     * `crm.objects.deals.write`
   * Create the app and copy the **Auth Token** from the Auth section.
2. **Credentials**
   * Set the following variable using your Private App’s Auth Token:
   * `HUBSPOT_PRIVATE_APP_ACCESS_TOKEN = <your private app auth token>`

### **EdgeTag Deployment**

1. **Navigate to Your EdgeTag Project**
   * Log in at [app.edgetag.io](https://app.edgetag.io/).
   * Select your site (e.g., `hgtmv.abcdefgh.com`).
   * Click **Add Channel → Webhook**.
2. **Configure Webhook Integration**
   * Ensure **Consent Categories** includes at least *Strictly necessary*.
   * Name your webhook (e.g., `HubSpot Lead & Deal`).
   * Leave the **Webhook URL** blank (EdgeTag will auto-generate).
   * Starter Template: Choose **HubSpot - Contact & Deal**
3. **Set Secrets**
   * Click **Add Secrets**.
   * Set:
     * **name:** `HUBSPOT_PRIVATE_APP_ACCESS_TOKEN`
     * **value:** your Private App’s Auth Token
4. **Save & Deploy**
   * Click **Save & Deploy** (upper-right).
   * EdgeTag will compile and activate the webhook.

### **Validation & Testing**

* Send a test lead: Use [Shopify Order Created](https://shopify.dev/docs/api/webhooks?accordionItem=webhooks-orders-create\&reference=toml) payload.
* In EdgeTag Logs, verify the script ran without exceptions.
* In HubSpot:
  * Confirm a Contact exists with the customer email.
  * Confirm a related Deal named `Order <orderId>` was created and linked to that Contact.
* If you encounter errors, contact the EdgeTag team.

### **Result**

The script will create or update the Contact in HubSpot, and create a Deal associated to that contact.

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.edgetag.io/channels/webhook/templates/hubspot-contact-and-deal.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
