(Plugin) Backend API

This article will teach you how to send code of email templates via backend API.

Marina Krivenets avatar
Written by Marina Krivenets
Updated over a week ago

Stripo Plugin Backend API endpoint allows inlining CSS styles into HTML tags and provides the final HTML code of email templates that is ready to be sent to recipients

In this case, your back-end should send the post request to our back-end with such information:

POST: /api/v1/cleaner/v1/compress
Host: https:
Content-Type: application/json
Header: ES-PLUGIN-AUTH: Bearer YOUR_AUTH_TOKEN
Accept: application/json
Body: {html:YOUR_HTML_CODE, css:YOUR_CSS_CODE, minimize:true}
Response: {html:HTML_READY_TO_BE_SENT}

As a response, our server will send you the HTML+CSS embedded.

This method is called "Compress", and it's not affected by the web-application because communication is Server-Server.

Please notice that you should call the initialization function every time a new email needs to be sent. Our back-end expects to get the needed parameter after initialization to establish a new session with a new getAuth token. 

To get YOUR_AUTH_TOKEN please take a look at this section.


Please be advised in case your email template contains AMP elements or components, then in response, you will see the ampHtml parameter that contains the HTML code of AMP HTML Mime type.

If AMP HTML is invalid, you will also get the ampErrors parameter that contains the error descriptions (array of strings).

An example of it you can find below:

Request:
curl -X POST https://plugins.stripo.email/api/v1/auth -k -H "Content-Type: application/json" -H "Accept: application/json" --data "{\"pluginId\":\"YOUR_PLUGIN_ID\",\"secretKey\":\"YOUR_SECRET_KEY\"}" -i

Response:
{"token":"YOUR_AUTH_TOKEN"}

Request:
curl -X POST https://plugins.stripo.email/api/v1/cleaner/v1/compress -k -H "Content-Type: application/json" -H "Accept: application/json" -H "ES-PLUGIN-AUTH: Bearer YOUR_AUTH_TOKEN" --data "{\"html\":\"Some html\",\"css\":\"body {color: green}\",\"minimize\":true}" -i

Response:
{"html":"Some html"}


Thank you for taking the time to read our articles. We hope you will find this information helpful.

If you have any additional questions, please email us at support@stripo.email.

We would be glad to talk with you.


Did this answer your question?