Templates Migrator v1
  • 27 Mar 2024
  • 5 Minutes to read

    Templates Migrator v1


      Article Summary

      This API enables you to migrate your templates to Insider, and reduce time spent on recreating templates. To complete this migration, get started with following requirements:

      1. Download the HTML of the email template from your vendor. Make sure that the HTML is covering the full content.
      2. Make sure to have an application to execute the operations (e.g. Postman, etc.).
      3. Generate the Email Template API key, and save it to use in the payload later. You can generate it on Inone Settings > Integration > Generate API Key > Email Template.
      4. Extract related premigration variables via Insider's API.
      5. Migrate templates with the extracted variables via Insider's API.

      This API allows you to migrate your promotional type of emails. Transactional email type is not supported in template migration.

      Your title goes here
      You should migrate your email templates one by one. Each payload in the migrator API should be prepared to migrate only one downloaded template to Insider's email template library.

      Extract Premigration Variables

      Before migrating your templates, you need to extract the following premigration variables: Template Variables, Dynamic Attributes, and URLs with URL parameters.

      Template Variables

      Template variables are in the form of {variable.color1} within the template. You need to provide accurate values for each template variable.

      Dynamic Attributes

      The response that will return for the request will contain two values for each dynamic attribute found:

      • attributeId: The attribute’s ID on your template. It is found in the format of contact.<id> on the template.
      • attributeName: The attribute’s corresponding name on your template. This value is the name of the attribute in your vendor. You need to provide Insider with the corresponding value. 
      Your title goes here
      You need to create custom dynamic attributes in Insider if you want to map these before sending your template to Insider.

      Each attribute ID corresponds to an attribute name on your template. See the full list of System Fields and Their IDs.

      To migrate your template, you will need to replace the attribute name with the corresponding Insider attribute name. See Insider's Default Attributes.

      To replace these attribute names with Insider attributes, you can use the attribute names in the {{my_attribute_name}} format. If you want to replace a custom attribute, the format should be {{c_subscription_expiry_date}}.

      For example, the response for extracting variables returns IDs 1 and 3. These IDs correspond to First Name and E-Mail on your template respectively. You should replace them with Insider's corresponding attributes when sending the request to migrate your template. In this case, they will be replaced with name and email respectively in the request as follows:

      "dynamic_attributes": {"1": "name", "3": "email"}

      URLs with URL parameters

      URLs with URL parameters are used for analytics and unsubscription links in most cases. For further information on the parameters URLs can get, refer to Email Personalization Placeholders.

      Insider tracks analytics by its own system. That's why these links will be removed. The unsubscription links will be replaced with Insider's unsubscription links.


      Endpoint and Headers

      POST https://mail.useinsider.com/content/v1/template-migration/vendorname/extract-premigration-variables

      Your title goes here
      Please verify the vendors, which are currently supported, with the Insider support team. Then, make sure to replace the {vendorname} in the endpoint with your own vendor name in lowercase.

      Headers

      HeaderSample ValueDescription
      X-INS-AUTH-KEY1a2b3c4d5e6fThis Email Template key is required to authorize your request. Refer to API Authentication Tokens to generate your token.
      Content-Typeapplication/jsonThis header specifies the media type of the resource.

      Body Parameters

      Before sending your request, make sure you create it within the following criteria:

      • Your template html should be in base64 format. 
      • Your template html should not contain any “view-in-browser” component, display conditions, email recommendations, coupon(s), or any other customized component.
      ParameterDescriptionData TypeRequired
      htmlYour template HTML in base64 formatStringYes

      Sample Request

      Every request made to the request endpoint requires a request body formatted in JSON

      your title goes here
      Make sure to replace the {vendorname} in the endpoint and auth key sample values in the request before sending your request.
      Your title goes here
      Only base64 format is supported for HTML.

      The following is a sample request to extract the premigration variables.

      curl --location --request POST 'https://mail.useinsider.com/content/v1/template-migration/vendorname/extract-premigration-variables' \
      --header 'x-ins-auth-key: 1a2b3c4d5e6f' \
      --header 'Content-Type: application/json' \
      --data-raw '{
          "html": "VGhpcyBpcyBhbiBleGFtcGxlIGh0bWwgY29udGVudA=="
      }'

      The following is a sample response.

      {
          "variables": [
              "fontfamily",
              "footer1color",
              "mainbackgroundcolor"
          ],
          "dynamic_attributes": [
              {
                  "attributeId": "1",
                  "attributeName": "First Name"
              },
              {
                  "attributeId": "3",
                  "attributeName": "E-Mail"
              }
          ],
          "urls_with_parameters": [
              "https://link.mywebsite.com/mo/$uid$_7655444662333189098.gif",
              "https://link.mywebsite.com/u/nrd.php?p=$uid$_1_9aAk3820kAopL30913c5295c3ee3d73180391nkc180912nf18409f7ed8fe5",
              "https://link.mywebsite.com/mo/$uid$_76480913468.gif"
          ]
      }

      Migrate Your Template with Extracted Variables

      To migrate your templates, you need to send them with the extracted variables and dynamic attributes if any.

      Endpoint and Headers

      POST https://mail.useinsider.com/content/v1/template-migration/vendorname/migrate

      Your title goes here
      Please verify the vendors, which are currently supported, with the Insider support team. Then, make sure to replace the {vendorname} in the endpoint with your own vendor name in lowercase.

      Headers

      HeaderSample ValueDescription
      X-INS-AUTH-KEY1a2b3c4d5e6fThis Email Template key is required to authorize your request. Refer to API Authentication Tokens to generate your token.
      Content-Typeapplication/jsonThis header specifies the media type of the resource.

      Body Parameters

      Before sending your request, make sure you create it within the following criteria:

      • Your template html should be in base64 format. 
      • Your template html should not contain any “view-in-browser” component, display conditions, email recommendations, coupon(s), or any other customized component.
      • Your variables should have a value mapping. For example, if you have the fontfamily variable, you should send it along with a font family value in the request.
      • Your dynamic attribute IDs should have a corresponding Insider attribute name as explained in "Dynamic Attributes" section.
      • You can keep the URLs with parameters and remove them yourself later, or let Insider remove them. The remove_urls_with_parameters key can get true or false accordingly.
      ParameterDescriptionData TypeRequired
      template_nameThe name your template will haveStringYes
      remove_urls_with_parametersIndicates if your URLs will be removed. BooleanYes
      htmlYour template HTML in base64 formatStringYes
      variablesThe extracted variables along with their valuesObjectYes
      dynamic_attributesThe extracted attributes along with their corresponding attribute names at InsiderObjectYes

      Sample Request

      The following is a sample request to migrate your template with variables and dynamic attributes.

      Your title goes here
      Make sure to replace the {vendorname} and auth key sample values in the request before sending your request.
      curl --location --request POST 'https://mail.useinsider.com/content/v1/template-migration/vendorname/migrate' \
      --header 'x-ins-auth-key: 1a2b3c4d5e6f' \
      --header 'Content-Type: application/json' \
      --data-raw '{
          "template_name": "My migrated template",
          "remove_urls_with_parameters": true,
          "html": "VGhpcyBpcyBhbiBleGFtcGxlIGh0bWwgY29udGVudA==",
          "variables": {"footer1color": "#ffffff", "mainbackgroundcolor": "#ffffff", "fontfamily": "Arial"},
          "dynamic_attributes": {"1": "name", "3": "email"}
      }'

      The request above migrates a template with the "My migrated template" name. It removes the URLs with parameters from the template. The footer1color, mainbackgroundcolor, and fontfamily variables have their own value mappings. Lastly, the attribute IDs 1 (First Name in your template) and 3 (E-Mail in your template) have Insider's corresponding attribute names as name and email.

      If your request is successful, your migrated template will be listed in Email Design > Choose Template > Custom Templates. You can select your template, and use the Drag & Drop Editor to edit it.


      Limitations

      • All functions must be executed with a simple HTTPS POST request.
      • The API Key should be provided as the authorization key on the request header. If the key is incorrect, the operation will not be executed.
      • The rate limit is 60 requests per minute.
      • Templates with "view-in-browser" component at the top are not supported for migration.
      • Templates with display conditions are not supported for migration.
      • Templates with email recommendation and coupon functionalities are not supported for migration.

      Was this article helpful?

      ESC

      Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses