sendgrid / email-templates

A repository of common email templates to use and modify to your heart's content.
https://sendgrid.com
MIT License
818 stars 987 forks source link

Reference a single item in an array by position #91

Open CastleandRook opened 2 years ago

CastleandRook commented 2 years ago

Actual Behaviour

Json `curl -X "POST" "https://api.sendgrid.com/v3/mail/send" \ -H 'Authorization: Bearer <>' \ -H 'Content-Type: application/json' \ -d '{ "from":{ "email":"example@.sendgrid.net" }, "personalizations":[ { "to":[ { "email":"example@sendgrid.net" } ], "dynamic_template_data":{

        "recently_viewed_products":[
           {
              "title":"Yellow A-line Gown by Teeze&nbsp;me",
              "image":"https://qny.queenly.com/wardrobe_grid/wardrobe-1631372397543.jpg",
              "link":"https://queenly.com/featured/night-out-dresses"
           },
           {
              "title":"Dress",
              "image":"https://marketing-image-production.s3.amazonaws.com/uploads/8dda1131320a6d978b515cc04ed479df259a458d5d45d58b6b381cae0bf9588113e80ef912f69e8c4cc1ef1a0297e8eefdb7b270064cc046b79a44e21b811802.png",
              "link":"URL"
           },
           {
              "title":"Dress",
              "image":"https://marketing-image-production.s3.amazonaws.com/uploads/8dda1131320a6d978b515cc04ed479df259a458d5d45d58b6b381cae0bf9588113e80ef912f69e8c4cc1ef1a0297e8eefdb7b270064cc046b79a44e21b811802.png",
              "link":"URL"
           },
           {
              "title":"Dress",
              "image":"https://marketing-image-production.s3.amazonaws.com/uploads/8dda1131320a6d978b515cc04ed479df259a458d5d45d58b6b381cae0bf9588113e80ef912f69e8c4cc1ef1a0297e8eefdb7b270064cc046b79a44e21b811802.png",
              "link":"URL"
           },
           {
              "title":"Dress",
              "image":"https://marketing-image-production.s3.amazonaws.com/uploads/8dda1131320a6d978b515cc04ed479df259a458d5d45d58b6b381cae0bf9588113e80ef912f69e8c4cc1ef1a0297e8eefdb7b270064cc046b79a44e21b811802.png",
              "link":"URL"
           },
           {
              "title":"Dress",
              "image":"https://marketing-image-production.s3.amazonaws.com/uploads/8dda1131320a6d978b515cc04ed479df259a458d5d45d58b6b381cae0bf9588113e80ef912f69e8c4cc1ef1a0297e8eefdb7b270064cc046b79a44e21b811802.png",
              "link":"URL"
           }

        ]
      }
  }

], "template_id":"d-c954edc39559465ba86fefbe2a10f357" }'`

I'd like to reference just one of the items in my email by its position. Was trying to use <img src="{{recently_viewed_prooducts.[0].image}}" alt="" width="250" height="330" border="0" style="display: block; max-width: 250px;"/>

However nothing is showing up

Expected Behaviour

Expected the first product in the arrays immage to show

Steps to reproduce it

Add steps to reproduce bugs or add information on the place where the feature should be implemented. Add links to a sample deployment or code.

Would you like to work on the issue?

I would like someone to help me on this issue