> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dittofeed.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Message - Journey Node

> Used to message users.

Message journey nodes are where the action's at. Without message nodes, journeys wouldn't do anything! Like the name suggests, message nodes are used to send messages to users.

## Example Use case - Basic Journey

The following is the most basic journey you can create.

<Frame>
  <img src="https://mintcdn.com/dittofeed/blTyhzJH4uYGEKZ4/images/minimal-useful-journey.png?fit=max&auto=format&n=blTyhzJH4uYGEKZ4&q=85&s=ada76c834d74b27b85d2bf8c969236e0" alt="Minimal Message Journey" width="3680" height="2234" data-path="images/minimal-useful-journey.png" />
</Frame>

## Webhook Synchronize Properties

The "Synchronize Properties" configuration option is available in webhook message nodes. This option ensures user properties and segments recompute after receiving a response to a webhook request, before proceeding. This feature is useful for rendering webhook response as a part of user properties.

<Frame>
  <img src="https://mintcdn.com/dittofeed/abmbv2I9puhRd1Zb/images/sync-options-webhook-message.png?fit=max&auto=format&n=abmbv2I9puhRd1Zb&q=85&s=19a68330a5c0fc796652d88a9890eb04" alt="Synchronize Options Webhook Message" width="3680" height="2382" data-path="images/sync-options-webhook-message.png" />
</Frame>

### Example Use case - Render Product Recommendations

Imagine that you want to email users with a list of their top 5 most highly recommended products. Let's say you have an API that returns product recommendations for a user. It would be infeasible to eagerly update Dittofeed every time any user's recommended products change.

Instead, we can use a webhook request to lookup products from your recommendations API, and render the response in an email. You can use the "Synchronize Properties" option when requesting new recommendations to ensure your journey waits until they're available before you proceed to render your email.

1. Create a webhook message template. Note that in the example below we use a secret to store an API key.

<Frame>
  <img src="https://mintcdn.com/dittofeed/abmbv2I9puhRd1Zb/images/recommendations-webhook-template.png?fit=max&auto=format&n=abmbv2I9puhRd1Zb&q=85&s=0ff584c678bca4bc76689310bfafae39" alt="Recommendations Webhook Template" width="3680" height="2382" data-path="images/recommendations-webhook-template.png" />
</Frame>

<Accordion>
  ```json theme={null}
  {
    "config": {
      "url": "https://recommendations.myapi.com/v1/recommendations",
      "method": "GET",
      "headers": {
        "Content-Type": "application/json"
      },
      "data": {
        "userId": "{{ user.id }}"
      }
    },
    "secret": {
      "headers": {
        "Authorization": "Bearer {{secrets.RECOMMENDATIONS_API_KEY}}"
      }
    }
  }
  ```
</Accordion>

2. Create a user property that renders the webhook response. This user property should condition on the `DFInternalMessageSent` event name, with the `variant.response.body` path. Furthermore, it should condition on the `templateId` property equaling `templateId` of the webhook message template you created e.g. `edfc6da5-f276-4937-9519-427e3164d9d8`.

<Frame>
  <img src="https://mintcdn.com/dittofeed/abmbv2I9puhRd1Zb/images/recommendations-user-property.png?fit=max&auto=format&n=abmbv2I9puhRd1Zb&q=85&s=a3e1316c73a31934b78493669d1efc4a" alt="Recommendations User Property" width="3680" height="2382" data-path="images/recommendations-user-property.png" />
</Frame>

3. Create an email template that consumes the user property.

<Frame>
  <img src="https://mintcdn.com/dittofeed/abmbv2I9puhRd1Zb/images/recommendations-email-template.png?fit=max&auto=format&n=abmbv2I9puhRd1Zb&q=85&s=5c5efba3c1e318840430b9112d9d1cc2" alt="Recommendations Email Template" width="3680" height="2382" data-path="images/recommendations-email-template.png" />
</Frame>

<Accordion>
  ```html theme={null}
  <mjml>
    <mj-body>
      <mj-section>
        <mj-column>
          <mj-text>Dear {{ user.firstName }},</mj-text>
          <mj-text>We've got some great product recommendations for you based on your preferences:</mj-text>
          {% for product in user.userProductRecommendations %}
          <mj-text>
            Product: {{ product.name }}<br />
            Brand: {{ product.brand }}<br />
            Price: ${{ product.price }}<br />
            Category: {{ product.category }}<br />
            Rating: {{ product.rating }} / 5<br />
            In Stock: {% if product.inStock %}Yes{% else %}No{% endif %}
          </mj-text>
          {% endfor %}
          <mj-text>We hope you find something you like!</mj-text>
          <mj-text>Best regards,<br />Your Store Team</mj-text>
        </mj-column>
      </mj-section>
    </mj-body>
  </mjml>
  ```
</Accordion>

4. Create a journey that sends a webhook request to your recommendations API, with the "Synchronize Properties" option enabled.

<Accordion>
  <Frame>
    <img src="https://mintcdn.com/dittofeed/abmbv2I9puhRd1Zb/images/sync-options-webhook-message.png?fit=max&auto=format&n=abmbv2I9puhRd1Zb&q=85&s=19a68330a5c0fc796652d88a9890eb04" alt="Synchronize Options Webhook Message" width="3680" height="2382" data-path="images/sync-options-webhook-message.png" />
  </Frame>
</Accordion>

5. Add an email message node to your journey, and select the email template you created.

<Frame>
  <img src="https://mintcdn.com/dittofeed/abmbv2I9puhRd1Zb/images/recommendations-journey.png?fit=max&auto=format&n=abmbv2I9puhRd1Zb&q=85&s=b01d3e35d5f0f3306010da99933f2bb1" alt="Recommendations Journey" width="3680" height="2382" data-path="images/recommendations-journey.png" />
</Frame>

***

## Walkthrough Video - Message Node

<iframe className="w-full aspect-video" src="https://www.youtube.com/embed/Ch6RNGoITqA?si=qaHKM7CyufAEiIYx" title="Message Nodes - Adding Email, Webhook, & SMS Templates To Journeys" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />
