# HTTP requests: Creating custom templates

URL: https://help.hubhus.com/kb/creating-custom-http-request-templates
Category: Integrations / HTTP
Updated: 2026-11-20T07:38:38.717788+00:00

Summary: Access: Campaign settings → HTTP & webhooks → + Create. Set: method (GET/POST/PUT/PATCH/DELETE), URL, headers, body - all support Hubhus placeholders. Optionally add a JSON map to write response values back to lead fields using HubhusProperty=ResponseJsonKey syntax. Test via the built-in tester before using in automations. Requires response status 2xx + valid JSON for maps to apply.

HTTP request templates let you send lead data to external APIs and automatically update lead fields based on the response - used for outbound webhooks, third-party integrations, and custom data flows.

## Get started in 3 steps

1. **Create the HTTP request template**. Go to **Campaign settings → HTTP & webhooks → + Create**. Set: **Method** (GET, POST, PUT, PATCH, DELETE), **URL** (supports placeholders like `%lead.id%`), **Request headers** (e.g. `Content-Type: application/json`, Authorization), **Request body** (JSON payload with Hubhus placeholders). Enable _URL encode placeholder values_ if placeholders appear in the URL path. Set a timeout appropriate for the external API response time (default 5 seconds, maximum 25 seconds). A longer timeout gives fewer timeouts, but when the other system is slow, the next request from the same action listener for the same lead waits correspondingly longer. Set **Retry failed requests** to **Yes** if the receiving system can be briefly unavailable (default **No**), see Read more. To let the receiving system ignore outdated requests, send the request number `<hh-http-request.id />`, see Read more.
2. **Add a JSON map (optional)**. A JSON map writes response values back to lead fields. After creating the template, click **+ New JSON map**. Write one mapping per line: `HubhusProperty=ResponseJsonKey`. Use dot notation for nested JSON ( `key1.key2`) and array indices ( `successes.0.lead_id`). Hubhus properties: `{{field-slug}}` for custom fields, `%lead_status_slug%`, `%assigned_person_email%`. Map only applies when response is 2xx + valid JSON.
3. **Test before using in production**. Use the built-in tester: select the template, enter a Lead ID, review the generated request (URL, headers, body), and click **Submit request**. Inspect the response: status code, headers, body (formatted JSON), and any JSON map results. Fix issues before wiring the template into automation rules. Use **Show all possible keys** in the JSON map tester to discover available response paths.

**Read more**

JSON map example

For this API response:

```
{ "keyA": 123, "key1": { "key2": "new-status" }, "successes": [{"lead_id": 456}] }
```

Map syntax:

```
{{external-id}}=keyA
%lead_status_slug%=key1.key2
{{created-lead-id}}=successes.0.lead_id
```

Triggering HTTP requests

HTTP request templates are used in:

- **Automation rules** - trigger automatically based on lead events
- **Action buttons** - trigger manually from the lead profile page
- **Action listeners** - trigger right after a change on the lead, see [Understanding action listeners](https://help.hubhus.com/kb/understanding-action-listeners)

### Retry failed requests

With **Retry failed requests** set to **Yes**, Hubhus sends the request again when a send from an automation, an action listener or a status action fails because of a temporary error. The setting is **No** by default, and cloning a campaign copies it.

- **Retried:** connection errors, timeouts, and HTTP status 408, 429 and any 5xx.
- **Not retried:** other 4xx responses, authentication errors, rejected requests, requests stopped by the URL check, and test requests from the built-in tester.
- **Schedule:** retry 1 after 30 seconds, retry 2 after 5 minutes and retry 3 after 1 hour. That is at most 4 attempts in total.
- **Current data:** each retry is built from the lead's current data and the current template. A retry is skipped if a later request with the same template to the same lead has succeeded.
- **Automations:** automations that react to HTTP requests (**On HTTP request**) react only to the final result, not to a failed attempt that will be retried.
- **Request limits:** the first attempt and its retries count as one request.
- **Request log:** each retry shows as **Retry n of 3**, and a pending retry shows when it is scheduled. After a failed status action, the user is told that the request failed and will be retried in 30 seconds.

### Ignore outdated requests with the request number

When several changes on a lead send requests close together, the receiving system can get them in a different order than they were sent. `<hh-http-request.id />` gives each request a number, so the receiving system can tell which request is the newest.

- **Where:** the URL, headers and body of the request template. It works in every send of the template: action listeners, automations, HTTP status actions, the built-in tester and retries. The URL, headers and body of one send get the same number.
- **Value:** the ID of the request's own entry in the request log, digits only.
- **Order:** the request gets its number before the lead's data is read, and all lead data, including the calendar event, is read after that. So a request that gets its number after a change was saved always contains that change.
- **Retries:** a retry is a new request and gets its own, higher number.
- **Numbers jump:** the numbers are shared across all Hubhus accounts, so they go up in jumps. Only compare them, and do not rely on the gaps.
- **Request limits:** a request rejected by the request limits also gets a log entry and a number.
- **Limits:** outside a send of a request template, e.g. in an email template or in the form an HTTP status action shows before sending, it shows a warning, or nothing with `mute-warning`. It does not order requests across different leads, and it is not a version number for the whole lead.

**On the receiving system:** keep the highest number already applied for each lead, and ignore a request with a lower number. This only works if every change you care about sends a new request, e.g. an action listener with **Run again if the lead changes while the actions run** set to **Yes**, see [Understanding action listeners](https://help.hubhus.com/kb/understanding-action-listeners).

```
URL:    https://example.com/hook?request=<hh-http-request.id />
Header: X-Request-Id: <hh-http-request.id />
Body:   {"lead_id": "%lead.id%", "request_id": <hh-http-request.id />}
```

The header name and the JSON keys are examples.

## Related articles

- https://help.hubhus.com/kb/connections-reusable-authentication-for-http-requests
- https://help.hubhus.com/kb/understanding-placeholders-and-dynamic-content
- https://help.hubhus.com/kb/how-do-i-use-action-buttons
- https://help.hubhus.com/kb/setting-up-gogift-integration-with-oauth-2-0
- https://help.hubhus.com/kb/understanding-action-listeners
