Stripo Plugin JS API can be accessed via window.StripoApi js object. To see the full description of each function you can in the API Documentation.

The list of available JS API functions:

getTemplate - You can use this function to save the updated template in your database. Call this method to save HTML and CSS to storage and later to load them to the editor again.
This method returns HTML and CSS codes with plugin internal extra styles and editor markup.

Format: callback(HTML, CSS, width, height).

Example of using:

window.StripoApi.getTemplate((html, css)=>{console.log(html)})

compileEmail - This function will be useful for preview in browser or sending the ready templates through the email service. This method returns compiled and compressed HTML code ready to be sent to clients.

Format: callback(error, html, ampHtml, ampErrors).

Example of using:

window.StripoApi.compileEmail((error, html, ampHtml, ampErrors) => {console.log(html)})

getTitle - This method returns email title.
setTitle - This method sets email title.

getHiddenPreHeader - This method returns hidden preheader in emails.
setHiddenPreHeader - This method sets hidden preheader in emails.

getGoogleAnnotations - This method returns the inserted the Gmail Promo Annotations microdata into HTML code of opened email template in the editor.

In case if microdata code is not presented there then the null value is returned.
If any of the parameters are disabled or empty then the empty data is returned (for example, discountCode: '').

You can find more information about every parameter on this page (press on the “Generate my code” button and check the “Microdata Format” tab) or on our blog here.

setGoogleAnnotations - This method inserts/updates the Gmail Promo Annotations microdata in HTML code of opened email template in the editor.

showAmpErrorsModal - Use this function To display the AMP validation errors in Stripo modal window if they present in the email template.

A detailed description about this function you can find here.

Please contact us to if any questions appear.

Did this answer your question?