@@ -82,9 +82,7 @@ const sendEmail = async () => {
82
82
.build ()
83
83
84
84
const templateless = new Templateless (' <YOUR_API_KEY>' )
85
- const result = await templateless .send (email)
86
-
87
- console .log (result)
85
+ await templateless .send (email)
88
86
}
89
87
90
88
sendEmail ()
@@ -145,9 +143,9 @@ Text component allow you to insert a paragraph. Each paragraph supports basic ma
145
143
146
144
``` javascript
147
145
Content .builder ()
148
- .text (" ## Thank you for signing up" )
149
- .text (" Please **verify your email** by [clicking here](https://example.com/confirm?token=XYZ)" )
150
- .build ()
146
+ .text (" ## Thank you for signing up" )
147
+ .text (" Please **verify your email** by [clicking here](https://example.com/confirm?token=XYZ)" )
148
+ .build ()
151
149
```
152
150
153
151
</details >
@@ -157,9 +155,8 @@ Link component adds an anchor tag. This is the same as a text component with the
157
155
158
156
``` javascript
159
157
Content .builder ()
160
- .link (" Confirm Email" , " https://example.com/confirm?token=XYZ" ) // or...
161
- .text (" [Confirm Email](https://example.com/confirm?token=XYZ)" )
162
- .build ()
158
+ .link (" Confirm Email" , " https://example.com/confirm?token=XYZ" )
159
+ .build ()
163
160
```
164
161
165
162
</details >
@@ -169,8 +166,8 @@ Button can also be used as a call to action. Button color is set via your dashbo
169
166
170
167
``` javascript
171
168
Content .builder ()
172
- .button (" Confirm Email" , " https://example.com/confirm?token=XYZ" )
173
- .build ()
169
+ .button (" Confirm Email" , " https://example.com/confirm?token=XYZ" )
170
+ .build ()
174
171
```
175
172
176
173
</details >
@@ -180,14 +177,14 @@ Image component will link to an image within your email. Keep in mind that a lot
180
177
181
178
``` javascript
182
179
Content .builder ()
183
- .image (
184
- " https://placekitten.com/300/200" , // where the image is hosted
185
- " https://example.com" , // [optional] link url, if you want it to be clickable
186
- 300 , // [optional] width
187
- 200 , // [optional] height
188
- " Alt text" // [optional] alternate text
189
- )
190
- .build ()
180
+ .image (
181
+ " https://placekitten.com/300/200" , // where the image is hosted
182
+ " https://example.com" , // [optional] link url, if you want it to be clickable
183
+ 300 , // [optional] width
184
+ 200 , // [optional] height
185
+ " Alt text" // [optional] alternate text
186
+ )
187
+ .build ()
191
188
```
192
189
193
190
Only the ` src ` parameter is required; everything else is optional.
@@ -216,9 +213,9 @@ OTP component is designed for showing temporary passwords and reset codes.
216
213
217
214
``` javascript
218
215
Content .builder ()
219
- .text (" Here's your **temporary login code**:" )
220
- .otp (" XY78-2BT0-YFNB-ALW9" )
221
- .build ()
216
+ .text (" Here's your **temporary login code**:" )
217
+ .otp (" XY78-2BT0-YFNB-ALW9" )
218
+ .build ()
222
219
```
223
220
224
221
</details >
@@ -230,25 +227,27 @@ These are all the supported platforms:
230
227
231
228
``` javascript
232
229
Content .builder ()
233
- .socials ([
234
- new SocialItem (Service .Website , ' https://example.com' ),
235
- new SocialItem (
Service .
Email ,
' [email protected] ' ),
236
- new SocialItem (Service .Phone , ' 123-456-7890' ), // `tel:` link
237
- new SocialItem (Service .Facebook , ' ExampleApp' ),
238
- new SocialItem (Service .YouTube , ' ChannelID' ),
239
- new SocialItem (Service .Twitter , ' ExampleApp' ),
240
- new SocialItem (Service .X , ' ExampleApp' ),
241
- new SocialItem (Service .GitHub , ' ExampleApp' ),
242
- new SocialItem (Service .Instagram , ' ExampleApp' ),
243
- new SocialItem (Service .LinkedIn , ' ExampleApp' ),
244
- new SocialItem (Service .Slack , ' Org' ),
245
- new SocialItem (Service .Discord , ' ExampleApp' ),
246
- new SocialItem (Service .TikTok , ' ExampleApp' ),
247
- new SocialItem (Service .Snapchat , ' ExampleApp' ),
248
- new SocialItem (Service .Threads , ' ExampleApp' ),
249
- new SocialItem (Service .Telegram , ' ExampleApp' ),
250
- ])
251
- .build ()
230
+ .socials ([
231
+ new SocialItem (Service .Website , ' https://example.com' ),
232
+ new SocialItem (
Service .
Email ,
' [email protected] ' ),
233
+ new SocialItem (Service .Phone , ' 123-456-7890' ), // `tel:` link
234
+ new SocialItem (Service .Facebook , ' Username' ),
235
+ new SocialItem (Service .YouTube , ' ChannelID' ),
236
+ new SocialItem (Service .Twitter , ' Username' ),
237
+ new SocialItem (Service .X , ' Username' ),
238
+ new SocialItem (Service .GitHub , ' Username' ),
239
+ new SocialItem (Service .Instagram , ' Username' ),
240
+ new SocialItem (Service .LinkedIn , ' Username' ),
241
+ new SocialItem (Service .Slack , ' Org' ),
242
+ new SocialItem (Service .Discord , ' Username' ),
243
+ new SocialItem (Service .TikTok , ' Username' ),
244
+ new SocialItem (Service .Snapchat , ' Username' ),
245
+ new SocialItem (Service .Threads , ' Username' ),
246
+ new SocialItem (Service .Telegram , ' Username' ),
247
+ new SocialItem (
Service .
Mastodon ,
' @[email protected] ' ),
248
+ new SocialItem (Service .Rss , ' https://example.com/blog' ),
249
+ ])
250
+ .build ()
252
251
```
253
252
254
253
</details >
@@ -266,6 +265,92 @@ Content.builder()
266
265
.build ()
267
266
```
268
267
268
+ </details >
269
+ <details ><summary >Store Badges</summary >
270
+
271
+ Link to your mobile apps via store badges:
272
+
273
+ ``` javascript
274
+ Content .builder ()
275
+ .storeBadges ([
276
+ new StoreBadgeItem (StoreBadge .AppStore , " https://apps.apple.com/us/app/example/id1234567890" ),
277
+ new StoreBadgeItem (StoreBadge .GooglePlay , " https://play.google.com/store/apps/details?id=com.example" ),
278
+ new StoreBadgeItem (StoreBadge .MicrosoftStore , " https://apps.microsoft.com/detail/example" ),
279
+ ])
280
+ .build ()
281
+ ```
282
+
283
+ </details >
284
+ <details ><summary >QR Code</summary >
285
+
286
+ You can also generate QR codes on the fly. They will be shown as images inside the email.
287
+
288
+ Here are all the supported data types:
289
+
290
+ ``` javascript
291
+ // url
292
+ Content .builder ()
293
+ .qrCode (" https://example.com" )
294
+ .build ()
295
+
296
+ // email
297
+ Content .builder ()
298
+ .
component (
QrCode .
email (
" [email protected] " ))
299
+ .build ()
300
+
301
+ // phone
302
+ Content .builder ()
303
+ .component (QrCode .phone (" 123-456-7890" ))
304
+ .build ()
305
+
306
+ // sms / text message
307
+ Content .builder ()
308
+ .component (QrCode .sms (" 123-456-7890" ))
309
+ .build ()
310
+
311
+ // geo coordinates
312
+ Content .builder ()
313
+ .component (QrCode .coordinates (37.773972 , - 122.431297 ))
314
+ .build ()
315
+
316
+ // crypto address (for now only Bitcoin and Ethereum are supported)
317
+ Content .builder ()
318
+ .component (QrCode .cryptocurrencyAddress (Cryptocurrency .Bitcoin , " 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" ))
319
+ .build ()
320
+
321
+ // you can also encode any binary data
322
+ Content .builder ()
323
+ .component (new QrCode (new Uint8Array ([1 , 2 , 3 ])))
324
+ .build ()
325
+ ```
326
+
327
+ </details >
328
+ <details ><summary >Signature</summary >
329
+
330
+ Generated signatures can be added to your emails to give a bit of a personal touch. This will embed an image with your custom text using one of several available fonts:
331
+
332
+ ``` javascript
333
+ // signature with a default font
334
+ Content .builder ()
335
+ .signature (" John Smith" )
336
+ .build ()
337
+
338
+ // signature with a custom font
339
+ Content .builder ()
340
+ .signature (" John Smith" , SignatureFont .ReenieBeanie )
341
+ .build ()
342
+ ```
343
+
344
+ These are the available fonts:
345
+
346
+ - ` SignatureFont.ReenieBeanie ` [ preview →] ( https://fonts.google.com/specimen/Reenie+Beanie )
347
+ - ` SignatureFont.MeowScript ` [ preview →] ( https://fonts.google.com/specimen/Meow+Script )
348
+ - ` SignatureFont.Caveat ` [ preview →] ( https://fonts.google.com/specimen/Caveat )
349
+ - ` SignatureFont.Zeyada ` [ preview →] ( https://fonts.google.com/specimen/Zeyada )
350
+ - ` SignatureFont.Petemoss ` [ preview →] ( https://fonts.google.com/specimen/Petemoss )
351
+
352
+ Signature should not exceed 64 characters. Only alphanumeric characters and most common symbols are allowed.
353
+
269
354
</details >
270
355
271
356
---
0 commit comments