Email renderers
Last updated
Was this helpful?
Last updated
Was this helpful?
An email renderer plugin is a that can be associated to an email template, allowing you to customize the rendering of the template.
If you don't know what a plugin is, you can find
Email renderers need to implement only one endpoint.
POST
myworker/v1/email_contents
This endpoint is called just before the email is sent. The email renderer replies to the request with the email content. There is no particular requirement on the latency, however, the best practice is to maintain a rendering latency below 200 ms.
email_tracking_url
string
The URL of the pixel tracking for view event to be inserted in the email content.
click_urls
array
The URLs to prepend the click through URL of the email content, see below.
user_data_bag
object
Customizable object.
user_identifiers
object
The available user identifiers for the user.
campaign_technical_anme
string
The campaign technical name.
campaign_id
string
The ID of the campaign.
creative_id
string
The ID of the email template.
context
string
The call context. One of LIVE
, STAGE
or PREVIEW
.
call_id
string
The email call ID.
email_renderer_id
string
The ID of the email renderer plugin instance. Used to retrieve the instance properties.
Field
Type
Description
from_name
String
to_email
String
to_name
String
reply_to
String
subject_line
String
The subject line, overriding the email campaign subject if defined.
Field
Type
Description
html
String (optional)
The html content of the email.
text
String (optional)
The text content of the email.
This object is customizable.
GET
https://api.mediarithmics.com/v1/creatives/:id/renderer_properties
Get the properties associated with the email renderer plugin instance.
id
string
ID of the email renderer plugin instance, typically theemail_renderer_id
from the incoming request.
An email renderer plugin has the EMAIL_TEMPLATE_RENDERER
plugin type. Its group id should be {domain.organisation.email-renderer}
(for example com.mediarithmics.email-renderer
).
Its artifact id should be the name of the email renderer plugin, i.e. example-email-renderer
.
We can provide you with a Hello World project using our SDK. Please contact your support to obtain access to it.
Your should extend EmailRendererPlugin
class and implement the onEmailContents
function from the plugin SDK.
The onEmailContents
function is called just before the email is sent. It is responsible for providing the email content to the router.
Don't forget to catch your errors. You should log / respond with the appropriate message to facilitate debugging.
POST
https://api.mediarithmics.com/v1/email_templates
type
string
"EMAIL_TEMPLATE"
renderer_group_id
string
renderer_artifact_id
string
organisation_id
string
The ID of the organisation
name
string
The name of the template.
editor_group_id
string
"com.mediarithmics.template.email"
editor_artifact_id
string
"default_editor"
See to learn why you should use the email_renderer_id
parameter to retrieve the instance properties.
About click_urls
: when constructing the final URL, it's essential that you properly URL encode the click URLs. For example, if you have List("http://url1/?redirect=", "
")
and a destination URL equal to http://dest/
, the result must be equal to http://url1/?redirect=http%3A%2F%2Furl2%2F%3Fredirect%3Dhttp%253A%252F%252Fdest%252F
which is http://url1/?redirect=url_encode(http://url2/?redirect=url_encode(http://dest/))
The code of the email renderer can call the following API endpoints to retrieve.
See the documentation to see .
Use our to create your email renderer plugin in Node.js: the required routes are already defined and you only have to override specific functions.
You can find a sample email renderer plugin .
The project structure and files work as .
You can monitor email router plugins.