> ## 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 SMS

> Add personalized product recommendations to MoEngage SMS campaigns using Jinja to send each user a relevant product name and link.

By adding recommendations to your SMS campaigns, you can send each user a product that matches their interests instead of the same message to everyone. In the SMS channel, recommendations are inserted into the message text using the [Jinja templating language](/docs/user-guide/campaigns-and-channels/getting-started/message-personalization/jinja-templating-language).

At MoEngage, creating an SMS 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 SMS 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>

<Note>
  SMS has a limited character count. A product set on its own inserts every item in the set, which can split the message into multiple SMS. Modify the Jinja code to fetch a single item, as described in step 11. The character count and the number of SMS appear below the preview.
</Note>

# Create SMS Campaigns with Recommendations

To create an SMS 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 **OUTBOUND**, click **SMS**.
4. Click **Periodic** campaign, and you can follow the same steps for any other SMS 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/_HwW2ndr7vLdjW7A/images/sms-new-campaign-periodic.png?fit=max&auto=format&n=_HwW2ndr7vLdjW7A&q=85&s=b2821e4b76efbf01a30935e933636624" alt="The New Campaign dialog box with SMS selected under Outbound and the Periodic delivery type" width="1504" height="1042" data-path="images/sms-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, click **Blank Template** under **Default templates**, or select a template under **Custom templates**. <img src="https://mintcdn.com/moengage/_HwW2ndr7vLdjW7A/images/sms-select-template.png?fit=max&auto=format&n=_HwW2ndr7vLdjW7A&q=85&s=1fc79ba88ca0ec68aa6dae9f1e5a35d1" alt="The Content tab showing the Blank Template option and the Custom templates list" width="3348" height="1832" data-path="images/sms-select-template.png" />
7. Select the sender in the **SMS sender** list.
8. In the **Message** field, type '@' where you want the recommendation to appear. The **SMS 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/_HwW2ndr7vLdjW7A/images/sms-personalization-window.png?fit=max&auto=format&n=_HwW2ndr7vLdjW7A&q=85&s=6e45f3995ffe4567023c9fe584eadd92" alt="The SMS Personalization window showing the Data personalization tab, the Select attribute list, and the Choose Fallback options" width="2244" height="642" data-path="images/sms-personalization-window.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 recommendation is replaced with an empty value. |
    | **Do not send SMS** | The SMS is not sent to that user. |
    | **Replace text** | The recommendation 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 Item Title theme={null}
      {% if ProductSet.Recommendations %}
      {% for product in ProductSet.Recommendations[0:1] %}
      {{product.title}}
      {% endfor %}
      {% else %}
      MOE_NOT_SEND
      {% endif %}
      ```

      ```jinja Item Link theme={null}
      {% if ProductSet.Recommendations %}
      {% for product in ProductSet.Recommendations[0:1] %}
      {{product.link}}
      {% endfor %}
      {% else %}
      MOE_NOT_SEND
      {% endif %}
      ```
    </CodeGroup>

    <img src="https://mintcdn.com/moengage/_HwW2ndr7vLdjW7A/images/sms-message-jinja.png?fit=max&auto=format&n=_HwW2ndr7vLdjW7A&q=85&s=43bfd4e9ca813f9df0061162fb5e7b14" alt="The Message field showing the auto-populated Jinja code for the product set" width="1970" height="1060" data-path="images/sms-message-jinja.png" />

    <Note>
      `MOE_NOT_SEND` stops the message from going out when the product set is empty for a user, so no one receives an SMS with a missing product.
    </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 recommendation. You can choose recommendations personalization or static textual content for different parts of the message.
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/_HwW2ndr7vLdjW7A/images/sms-personalized-preview.png?fit=max&auto=format&n=_HwW2ndr7vLdjW7A&q=85&s=af42cfc3e2803b27a9323ce991d60cc1" alt="The Personalized preview slide-out showing the product set JSON and the Update preview button" width="1978" height="1076" data-path="images/sms-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 SMS Campaign](/docs/user-guide/campaigns-and-channels/sms-mms-and-rcs/sms/personalize-sms-campaign)
* [Personalize Content Using Recommendations](/docs/user-guide/campaigns-and-channels/getting-started/message-personalization/personalize-content-using-recommendations)
* [Using Recommendations in Push](/docs/user-guide/content/recommendations/personalize-campaign-with-recommendations/using-recommendations-in-push)
* [Using Recommendations in WhatsApp](/docs/user-guide/content/recommendations/personalize-campaign-with-recommendations/using-recommendations-in-whatsapp)
* [Using Recommendations in MMS](/docs/user-guide/content/recommendations/personalize-campaign-with-recommendations/using-recommendations-in-mms)


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