Forum Discussion

Kelly_Grote's avatar
Kelly_Grote
Active Member
9 days ago

SMS & Using liquids for links

Hi All! I have a question about SMS and app links. I am trying to use liquid logic to change the link based on the device they are receiving the SMS message. I want to change the deeplink to change to ios or Android depending on which device it is sent to. I am having trouble even getting the ios deeplink to populate as a link, as well as using the right attribute and liquid to populate the correct link. Has anyone done this before? I would love any help. Thanks!

  • rayelkho's avatar
    rayelkho
    Practitioner III

    Hi Kelly_Grote . Can you share an example of what you are trying to do? 

    I just tested this code and it worked, I was able to send an SMS to my iOS device only.

    {% if  {{targeted_device.${platform}}} == 'ios" %}
    iPhone 
    {% else %}
    Not iPhone
    {% endif %}

    • Kelly_Grote's avatar
      Kelly_Grote
      Active Member

      Thank you! I will see if something like that works. This is what I was doing per Braze recommendation but it is not working right. 

      {% assign most_recent_app_version_var = {{most_recently_used_device.${os}}} %}

      {% assign most_recent_app_version_1 = {{most_recently_used_device.${model}}}

      %}

      {% if most_recent_app_version_1 contains 'iPhone' %}

      ๐Ÿš€ IPHONE fieldview://reports

      {% elsif most_recent_app_version_1 contains 'iPad' %}

      ๐Ÿš€ IPAD fieldview://reports

      {% elsif most_recent_app_version_var contains 'Android' %}

      ๐Ÿš€ ANDROID 

      https://climate.com/ul/reports

      {% else %}

      {% abort_message('User does not have a compatible OS') %}

      {% endif %}

      • rayelkho's avatar
        rayelkho
        Practitioner III

        Have you tried to view as a custom user and see what populates when you input "iPhone" in the most_recently_used_device?

        You just have to update your code to show the object: {{most_recent_app_version_1}}

  • TedScott's avatar
    TedScott
    Practitioner III

    Hi Kelly,

    The other comments how to check are good, but if you go that route, be sure use an else for some sort of default url since they may not be on the device you are expecting.

    The issue is that you will not have OS for every number and the OS you do have will not necessarily be iOS or Android.  What you will be relying on from the examples would be the last seen device and that might not be related to the phone at all.  Don't forget that there are also non-mobile was to receive SMS like google voice or their ISP like Comcast/Xfinity.

    You could populate both urls, but of course that might put you over on message blocks, so my suggestion would be to create a landing page with both the iOS and Android options you want to offer and think to that in the SMS (be sure to use UTM's or other url parameters for tracking).

    Hope this helps!

    Best,
    Ted