mddanishyusuf / dailyhack

🐱‍💻 Tiny Tiny Hacks we use in our daily life.
https://dailyhack.now.sh/
149 stars 15 forks source link

Make Dynamic Email Template with JSON data or APIs #87

Open mddanishyusuf opened 5 years ago

mddanishyusuf commented 5 years ago

Dynamic Email Template

This tool will Generate Email Template Code with Dynamic Data as JSON object or API. Get the generated email template and add into Mailchimp, Sendgrid or whatever service you are using to send newsletters.

Tool Website: https://dynamic-template.xyz

How to use

Step 1 : Add your template code into "Code" with Handlebars syntax to iterate and bind dynamic data with Email Template code. Ex:

<table>
    <tr>
        <td>
            <h2>Public APIs Weekly</h2></td>
    </tr>
    {{#each items}}
    <tr>
        <td>
            <h3 style="margin: 0; padding:0">{{title}}</h3>
            <p style="margin: 0; padding:0">{{description}}</p>
        </td>
    </tr>
    {{/each}}
</table>

Here you can get to know about Handlebars syntax https://handlebarsjs.com/

Step 2 : Add the JSON data into "Test Data" to bind with the Email Template. If you have API endpoint for the data then you can alse get data through your REST API. Just add your API and click "Get Data". Ex:

{
  "name": "Danish",
  "email": "mddanishyusuf@gmail.com",
  "items": [
    {
      "title": "GitHub API",
      "description": "Information for a user's Github profile"
    },
    {
      "title": "Open Collective",
      "description": "Platform where communities can collect and disburse money transparently to sustain themselves and develop their activities"
    },
    {
      "title": "Fortnite",
      "description": "Fortnite Stats & Cosmetics"
    }
  ]
}

That's all.

Get your generated Email Template from "Template".

Tool Website: https://dynamic-template.xyz