# Using webhook response data in your journey

## Overview

When you [map values from a webhook response](/product/customer-journey/journey-elements/channels/webhook/#map-webhook-response-data-to-variables), Pushwoosh stores them as variables you can use later in the journey, anywhere you'd otherwise use an [Event attribute](/product/audience-data-and-segmentation/events/#2-set-attributes).

<Aside type="note">
To add a **Webhook** element and configure **Response mapping**, see [Webhook](/product/customer-journey/journey-elements/channels/webhook/#map-webhook-response-data-to-variables).
</Aside>

## Save a webhook value as a Tag with Update user profile

A [**Webhook**](/product/customer-journey/journey-elements/channels/webhook/#map-webhook-response-data-to-variables) can return data from an external system, such as a CRM user ID or subscription status, that Pushwoosh does not store on the user profile yet. [**Update user profile**](/product/customer-journey/journey-elements/flow-controls/update-user-profile/#use-a-value-from-a-webhook-response) saves mapped values as [Tags](/product/audience-data-and-segmentation/user-data-tags/tags/) so you can use them in [segments](/product/audience-data-and-segmentation/segmentation/), [dynamic content](/product/personalization/dynamic-content/), and later journey steps.

### Example: save a CRM user ID as a Tag

A new user signs up in your app, and the journey creates a matching record in your CRM. Saving the returned CRM user ID as a Tag lets you reference or update the same CRM record later, for example from another journey or a follow-up Webhook call, instead of creating a duplicate record each time the user re-enters the journey.

**Journey flow:** Trigger-based Entry → Webhook → Update user profile → Exit

1. Create a journey with **Trigger-based Entry** on the `SignUp` event.
2. Add a **Webhook** element after the entry step. Name it (for example, `Create user in CRM`) and set the request URL to your CRM create-user endpoint.
3. In **Response mapping**, set **Path** to the ID field in the response (for example, `data.user.id`) and **Attribute** to `crm_user_id`.

<img src="/journey-elements-webhook-response-data-1.webp" alt="Webhook response mapping with Path data.user.id and Attribute crm_user_id" />

4. Add an **Update user profile** element after the **Webhook** step.

5. In **Dynamic Tag Value**, click **+ Dynamic Value**. In **Tag**, select the Tag that stores the CRM ID (create it in advance if needed). In **Event**, select the webhook step by the name you gave it (`Create user in CRM`). In **Dynamic Value**, select `crm_user_id`.
<img src="/journey-elements-webhook-response-data-2.webp" alt="Dynamic Tag Value with Tag for CRM ID, Event Webhook step, and Dynamic Value crm_user_id" />
6. Add **Exit** at the end of the branch.
<img src="/journey-elements-webhook-response-data-3.webp" alt="Journey branch ending with Exit after Update user profile step" />

<Aside type="caution">
If the webhook value is missing for a user (the response wasn't JSON, the **Path** didn't resolve, or the call failed), Pushwoosh skips that Tag update. The Tag keeps its previous value or stays unset, and the journey continues with no error at this step. Run [**Test webhook**](/product/customer-journey/journey-elements/channels/webhook/#test-the-webhook) before launch to confirm your mapping. [Learn more](/product/customer-journey/journey-elements/flow-controls/update-user-profile/#use-a-value-from-a-webhook-response).
</Aside> 

## Schedule a delay from a webhook value with Time Delay

Visit dates, renewal deadlines, and delivery windows often live in an external booking or billing system. After a [**Webhook**](/product/customer-journey/journey-elements/channels/webhook/#map-webhook-response-data-to-variables) maps the date from the API response, [**Time Delay**](/product/customer-journey/journey-elements/flow-controls/time-delay/#use-a-date-from-a-webhook-response) can pause the journey until that moment, for example 2 days before an appointment, so the next message goes out on time.

### Example: schedule a reminder from a date in the response

A user books an appointment in your app. The journey fetches the visit date from your booking system and sends a push reminder 2 days before the visit.


1. Create a journey with **Trigger-based Entry** on the `AppointmentBooked` event.
2. Add a **Webhook** element after the entry step. Name it (for example, `Get appointment details`) and set the request URL to your booking system API.
3. In **Response mapping**, set **Path** to the date field in the response (for example, `appointment.date`) and **Attribute** to `visit_date`.
<img src="/journey-elements-webhook-response-data-4.webp" alt="Webhook step with response mapping for appointment.date to visit_date" />
4. Add a **Time Delay** element after the **Webhook** step. Select **Based on user/event data**, set **Get date from** to **Event**, set **Event** to the webhook step by the name you gave it (`Get appointment details`), set **Event value** to `visit_date`, and set the delay to **Before** `2` **Days**.
<img src="/journey-elements-webhook-response-data-5.webp" alt="Time Delay configured from webhook visit_date with Before 2 Days offset" />
5. If users can book less than 2 days before the visit, enable **Split to branches if the date's in the past or date is empty** on the **Time Delay** element. This creates two branches, **In the past** and **In the future**. See [Split branches when the date is in the past or empty](/product/customer-journey/journey-elements/flow-controls/time-delay/#split-branches-when-the-date-is-in-the-past-or-empty).
6. Add a **Push** step with your reminder message. If split is enabled, add this **Push** in both branches: **In the past** (send immediately) and **In the future** (after **Time Delay**).
7. Add **Exit** at the end of each branch.
<img src="/journey-elements-webhook-response-data-6.webp" alt="Time Delay split into In the past and In the future branches, each with Push and Exit steps" />

<Aside type="caution">
If the mapped value is missing or not a valid date, the user exits the journey with an error at this step. 

If the visit is sooner than 2 days away, the **Before** `2` **Days** target is already in the past when the user reaches **Time Delay**, and the user leaves the journey with no error and no reminder unless you enable **Split to branches if the date's in the past or date is empty**. 

Unlike [**Update user profile**](/product/customer-journey/journey-elements/flow-controls/update-user-profile/#use-a-value-from-a-webhook-response), which leaves the Tag unchanged and continues, **Time Delay** stops the user when the date is missing, invalid, or in the past (without branch splitting).
Make sure your webhook reliably returns a date in a [supported format](/product/customer-journey/journey-elements/flow-controls/time-delay/#delay-based-on-user-or-event-data). Run [**Test webhook**](/product/customer-journey/journey-elements/channels/webhook/#test-the-webhook) before launch. [Learn more](/product/customer-journey/journey-elements/flow-controls/time-delay/#use-a-date-from-a-webhook-response).
</Aside>

## Things to keep in mind

* **Path syntax:** use a dot-separated path (for example, `data.user.id`). Wildcards and filters are not supported. See [Webhook response mapping](/product/customer-journey/journey-elements/channels/webhook/#map-webhook-response-data-to-variables) for details.
* **Response size:** responses larger than 64 KB are not processed for mapping.
* **Testing:** run [**Test webhook**](/product/customer-journey/journey-elements/channels/webhook/#test-the-webhook) in the **Webhook** element before you use mapped values in a live journey.