Hasty Briefsbeta

Bilingual

How to Call an API from an Email

21 hours ago
  • #CSS Hacks
  • #Web Development
  • #Email Technology
  • Emails cannot run JavaScript, limiting interactivity, but they can still perform tasks using techniques like AMP Email and CSS tricks.
  • AMP Email allows limited interactive features like forms without redirects, but it's restrictive, poorly supported, and often abandoned by Google.
  • Using CSS 'crimes' like checkboxes and background-image loading enables API calls from emails without JavaScript, achieving ~70% client support.
  • Image-based API calls via CSS have drawbacks: they only detect first clicks, rely on non-standardized behavior, and risk breaking due to client changes.
  • Production email implementations require handling errors, restoring state, and performing math without JavaScript, but these challenges are solvable with advanced techniques.