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

# Using Recommendations in WhatsApp

> Add personalized product recommendations to MoEngage WhatsApp campaigns using approved templates and Jinja to send relevant products to each user.

By adding recommendations to your WhatsApp campaigns, you can send each user the products most relevant to them instead of the same message to everyone. In the WhatsApp channel, recommendations are inserted into the placeholders of a pre-approved WhatsApp template using the [Jinja templating language](/docs/user-guide/campaigns-and-channels/getting-started/message-personalization/jinja-templating-language).

At MoEngage, creating a WhatsApp campaign is a three-step process.

1. Target users
2. Content
3. Schedule and Goals

You can personalize the campaign with recommendations in the second step 'Content'. Let us create a recommendation personalized WhatsApp campaign.

<Warning>
  Ensure that you have created the desired recommendations. You can use only active recommendations for campaign personalization. Learn how to [create and manage recommendations](/docs/user-guide/content/recommendations).
</Warning>

# Prerequisites

Unlike Email and Push, WhatsApp requires an approved template before you can personalize content. Ensure the following:

* A recommendation (product set) is set up and mapped to a user action. Refer to [Map User Actions Settings](/docs/user-guide/content/recommendations/prerequisites/map-user-actions-settings).
* You have a pre-approved WhatsApp template with enough placeholders to hold the recommendation data. For example, to send a user's name plus a recommended product's title and link, get a template approved with three placeholders. Refer to [WhatsApp Templates](/docs/user-guide/campaigns-and-channels/whatsapp/getting-started-with-whatsapp/whatsapp-templates).

# Create WhatsApp Campaigns with Recommendations

To create a WhatsApp campaign with recommendations, perform the following steps:

1. On the sidebar menu in MoEngage, hover over the Engage menu item <img alt="The Engage menu icon" src="https://mintcdn.com/moengage/_fazdN5K6hQMBuV9/images/moengage_3a6ded.png?fit=max&auto=format&n=_fazdN5K6hQMBuV9&q=85&s=5b7311df5455793975271a77743d0dc4" style={{ display: "inline-block", height: "20px", width: "auto" }} width="38" height="32" data-path="images/moengage_3a6ded.png" /> . The **Engage** menu appears.
2. Click **+ New Campaign**. <img src="https://mintcdn.com/moengage/2CGhjk8ZDWEC5ocb/images/moengage_f884be.png?fit=max&auto=format&n=2CGhjk8ZDWEC5ocb&q=85&s=0ada01182ce9b14f1ee343c52b517b74" alt="The Engage menu with the New Campaign option" width="562" height="474" data-path="images/moengage_f884be.png" /> You can also click **All Campaigns** on the **Engage** menu and then click **+ Create campaign** on the All campaigns page.
3. On the **New Campaign** dialog box, under **MESSAGING APPS**, click **WhatsApp**.
4. Click **Periodic** campaign, and you can follow the same steps for any other WhatsApp campaign type. For more information about delivery types, refer to [Delivery Types](/docs/user-guide/campaigns-and-channels/getting-started/introduction/delivery-types-moengage-channels). <img src="https://mintcdn.com/moengage/AqE2bsr1IF39nHOR/images/whatsapp-new-campaign-periodic.png?fit=max&auto=format&n=AqE2bsr1IF39nHOR&q=85&s=55b22117606b6dd9dfa5be2c5e81a5f2" alt="The New Campaign dialog box with WhatsApp selected under Messaging Apps and the Periodic delivery type" width="1492" height="1042" data-path="images/whatsapp-new-campaign-periodic.png" />
5. Enter the basic campaign details and define the audience in step 1 'Target users' and click **Next**.
6. In step 2, on the **Content** tab, select the sender in the **Select sender** list.
7. Select the approved template in the **Select template** list. <img src="https://mintcdn.com/moengage/S2vOz7ciYYqlhjCf/images/moengage_6b5913.png?fit=max&auto=format&n=S2vOz7ciYYqlhjCf&q=85&s=9421727e6780bf0ab364113870011cd0" alt="Selecting the sender and the approved template on the Content tab" width="2656" height="978" data-path="images/moengage_6b5913.png" />
8. In the **Header** or **Body** placeholder field, type '@'. The **WhatsApp Personalization** window opens.
9. On the **Data personalization** tab, in the **Select attribute** list, search for your recommendation and select it under **Product sets**. <img src="https://mintcdn.com/moengage/dLyLAwgfsm1v6_MY/images/moengage_86260a.png?fit=max&auto=format&n=dLyLAwgfsm1v6_MY&q=85&s=9e359f5a15c90f0b0ecc68a7507b65c4" alt="The WhatsApp Personalization window showing the Data personalization tab and the Choose Fallback options" width="1306" height="1028" data-path="images/moengage_86260a.png" />
10. Under **Choose Fallback**, select a fallback and click **Done**.
    The **Choose Fallback** option controls what a user receives when personalization fails for them:

    | Fallback | What happens |
    | - | - |
    | **No fallback** | The placeholder is replaced with an empty value. |
    | **Do not send campaign** | The campaign is not sent to that user. |
    | **Replace text** | The placeholder is replaced with the text you enter. |
11. It auto-populates some Jinja code retrieving all available items list from recommendations. You can modify the code for your use case. For example, the following is the modified code to display one item:
    <CodeGroup>
      ```jinja JINJA theme={null}
      {% if ProductSet.RealTimeAIRecommendations%}
      {% for product in ProductSet.RealTimeAIRecommendations[0:1]%}
      {{product.title}}
      {% endfor %}
      {% else %}
      MOE_NOT_SEND
      {% endif %}
      ```
    </CodeGroup>
    <Note>
      `MOE_NOT_SEND` stops the message from going out when the product set is empty for a user, so no one receives a message with a blank placeholder.
    </Note>
12. To display an item attribute, place the cursor inside the `for` loop, type '@', and select the attribute in the **Select attribute** list. The attribute is inserted inside the loop, for example `{{product['price']}}`.
13. Repeat steps 8 to 12 for each remaining placeholder in the template. You can choose recommendations personalization or static textual content for different placeholders.
14. After you complete the setup, under **Preview type**, click **Personalized**. MoEngage selects a user and renders the message with real values.
15. To preview the message for a specific user, click the edit icon <img alt="The edit icon" src="https://mintcdn.com/moengage/q2ALITKbE0y0S_CF/images/personalized-preview-edit-icon.png?fit=max&auto=format&n=q2ALITKbE0y0S_CF&q=85&s=848f3575779c106dc8204643a48b5b83" style={{ display: "inline-block", height: "16px", width: "auto" }} width="34" height="24" data-path="images/personalized-preview-edit-icon.png" /> . The **Personalized preview** slide-out opens.
16. In the **Select user by** list, select the identifier you want to use.
17. In the **User identifier value** field, type the identifier of the user.
18. Click **Fetch user data**. Under **Personalization inputs**, your product set appears as JSON with the items available for that user.
19. Change the JSON to match what you want to preview. (Optional)
20. Click **Update preview**. <img src="https://mintcdn.com/moengage/AqE2bsr1IF39nHOR/images/whatsapp-personalized-preview.png?fit=max&auto=format&n=AqE2bsr1IF39nHOR&q=85&s=72a77a357ff0cf472b47f028d9033a5b" alt="The Personalized preview slide-out showing the product set JSON and the rendered message" width="1644" height="1072" data-path="images/whatsapp-personalized-preview.png" />
    <Note>
      To enable **Update preview** for your account, contact your MoEngage CSM or the Support team. For more information, refer to [Personalized Preview](/docs/user-guide/campaigns-and-channels/getting-started/message-personalization/personalized-preview).
    </Note>
21. You can also deliver a test campaign to ensure end-to-end delivery before scheduling it for all users. <img src="https://mintcdn.com/moengage/prFQLkdcYp4xSt9t/images/moengage_64d866.png?fit=max&auto=format&n=prFQLkdcYp4xSt9t&q=85&s=418af816177da54b157eb6fc1262ec7e" alt="The Test Campaign panel" width="2684" height="472" data-path="images/moengage_64d866.png" />
22. After you complete the content setup with recommendations, click **Next** at the bottom and move to 'Schedule and Goals', which is the step 3 of campaign setup.
23. Set up the appropriate settings in **Schedule and Goals** and publish the campaign.

# Related Articles

* [Personalize WhatsApp Campaign](/docs/user-guide/campaigns-and-channels/whatsapp/create/personalize-whatsapp-campaign)
* [Personalize Content Using Recommendations](/docs/user-guide/campaigns-and-channels/getting-started/message-personalization/personalize-content-using-recommendations)
* [Using Recommendations in Email](/docs/user-guide/content/recommendations/personalize-campaign-with-recommendations/using-recommendations-in-email)
* [Using Recommendations in Push](/docs/user-guide/content/recommendations/personalize-campaign-with-recommendations/using-recommendations-in-push)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.