What is Mailigen?
Mailigen is newsletter creation and automation platform. Platform offers management of contact lists, creation of letter templates using WYSIWYG e-mail template editor, analysing campaign results and more. We can send Standard ERP customer letters such as announcements or adverts using them as delivery mechanism.
What are the benfits?
There are multiple benefits using Mailigen instead of delivery of e-mails through your SMTP server:
- specialised delivery mechanism for mass mail - they make sure that everything is OK with spam filters and other issues that might arise when trying to send large newsletters out using normal SMTP server. In most cases it is not even allowed by the SMTP provider to send campaign letters
- possibility to create beautiful e-mail templates for your letters with ease
- tracking of your e-mail campaign such as who opened e-mails, who clicked on links etc. to be able to follow up and analyse efficiency of the campaign
Read more on Mailigen features
How to start with Mailigen
- You need to subscribe for a Mailigen account or start with a trial account
- You need to create an API key from Mailigen admin interface and send to us
- We will set up code for you that will be able to communicate with Mailigen from Standard ERP
- Add Mailigen settings in CRM > Settings > Mailigen Settings
- Script runner - node (or full path to node, if just node does not work)
- Campaign file location path - location, where the generated campaign and other informational files will be located. These indicate, which campaigns have been created. Example - tmp-mailigen/. The folder must exist!
- Mailigen file location path - location, where the Mailigen code execution files are located. In a previous step, the git/mailigen folder was linked to mailigen, so this should be mailigen/
- API key - From Mailigen > Settings > API keys
- Authentication key - should match the parameter "key" defined in Webhook call URL
- Main List Web ID - Mailigen contact list ID, that can be found in the URL, when the appropriate list is opened (https://admin.mailigen.com/contacts/dashboard/?id=XXXXXX, where X is a number)
- Activity type - Activity type for activities that will be created for all of the recipients of the Customer Letter after Letter is OKed
Importing contacts to lists
After the technical set up is done, you need to manually transfer your contacts from Standard ERP to Mailigen. In order to do so, follow these steps:
Default contact validation: Only contacts that are customers, are not closed and do not have the "No Mass Emailing" checkbox ticked are considered valid for Mailigen lists. If the category is indicated in the setting, only contacts with this category are considered valid
- In the Mailigen settings indicate which customer categories should be included in the contact list, separated by a comma (Setting - Include only categories). If all customer categories should be included, then leave this field blank
- In Mailigen, create a new Subscriber list
- Under List Actions, choose Custom fields to edit the fields in the list
- Add a new field labelled "Contact" (this label can be named something else too) and name the Merge Tag "CONTACT" (this cannot be modified)
- Do not change the Merge Tag of the default field "First Name". These are the required fields, other fields are optional. The list should look like this:
- To create a Main list:
- Run the report "Burti - Mailigen Contact List", which will return all of the customers that match the categories defined in the previous setting, and save it to an .xls file
- In Mailigen > Lists > My Lists - choose a List > Actions > Import - choose the previously exported .xls file and import
- To create a Classification list:
- In the CRM >> Settings >> Burti - Mailigen Lists create a new row, indicating the list name, specific classifications and list web ID, as described below
- Run the maintenance "Burti - Mailigen populate Contact Lists", which will update all the specified lists with the valid contacts
- Once the list is created, copy the list ID that is displayed in the url, when the list is open and being viewed (https://admin.mailigen.com/contacts/dashboard/?id=XXXXXX , where X is a number).
- If you are creating a Main list (list with all the contacts), save this ID in the Mailigen setting "Main list Web ID"
- If you are creating a classification list, save this ID in the Mailigen lists setting column "Contact List Web ID" in the corresponding classification row. The setting should look something like this:
If a new list is created and has to be used in place of the old list, update the list Web ID setting and leave the list ID blank (List ID is automatically populated after a request to Mailigen, if the list Web ID is supplied )
It is very easy to create a list from SERP using flex.bi with a report definition like this:
{ "cube_name": "HansaWorld CRM", "cube_reports": [ { "name": "All customer e-mails", "result_view": "table", "definition": {"columns":{"dimensions":[{"name":"Measures","selected_set":["[Measures].[Customer e-mail]","[Measures].[Customer primary contact]"],"members":null}]},"rows":{"dimensions":[{"name":"Customer","selected_set":["[Customer].[Customer].Members"],"members":null,"bookmarked_members":null}],"filter_by":{"conditions":[{"expression":["[Measures].[Customer e-mail]"],"operator":"matches","value":".+@.+"}]},"nonempty_crossjoin":true},"pages":{"dimensions":null},"options":{"nonempty":true},"view":{"current":"table","maximized":false,"table":{}}} } ], "calculated_members": [{"name":"Customer e-mail","dimension":"Measures","formula":"[Customer].CurrentMember.getProperty('E-mail')","format_string":""},{"name":"Customer primary contact","dimension":"Measures","formula":"[Customer].CurrentMember.getProperty('Primary contact')","format_string":""}] }
Contact updates from Mailigen to SERP
Next, it is necessary to create Webhooks, so that when a contact unsubscribes or changes their email, the changes get sent to HW.
- In Mailigen, go to Settings > Webhooks
- Create a new Webhooks:
- "Trigger on" - tick "email address changes" and "unsubscribes"
- "List" - should be the same list indicated in a setting (each webhook applies only to one list, for multiple lists create multiple webhooks)
- "URL" - should be http://yourserver.com:port/Web_JSON_Mailigen_Updating.hal?key=[key]
- Port is optional, only if needed
- The parameter "key" is required and should match the key defined in the field "Authentication key" in Mailigen settings - it can be whatever you decide
- "Send updates made by" - tick "a subscriber" and "account admin"
If a contact unsubscribes from the emails through Mailigen, he is automatically removed from the list and the checkbox "No Mass Emailing" is ticked in SERP.
If a contact's email gets changed through Mailigen, the contact in SERP with the previous email is found, and changed to the new one.
Contact updates from SERP to Mailigen
To enable automatic contact updates to Mailigen, make sure to check "Enable Mailigen Integration" in Mailigen Settings
The Main contact list in Mailigen is automatically updated if:
- Contact is added, if:
- A new contact is created, that matches the default criteria
- An existing contact, that did not previously match the criteria, after updating now matches all of the criteria
- Contact is removed, if:
- An existing contact previously matched the default criteria, but after updating does not
- An existing contact is deleted
- Contact is updated, if the contact's email, name or primary contact is changed
The Classification contact lists in Mailigen are automatically updated if:
- Same default validations apply to classification lists, as with the Main list
- Contact is added, if:
- A new contact is created, that matches the classifications defined in the Mailigen Classification lists setting
- An existing contact's classifications changed, and previously did not match any classifications for the classifications lists, but now does
- Contact is removed, if the contact's classifications change, and he does not match the classification requirements anymore
List segments
The logic is that in Mailigen the complete contact list is stored and when creating Customer Letters it is possible to indicate a subsection of these contacts that will receive this particular Customer Letter. The recipients of the particular Customer Letter are sent to Mailigen, and only the recipients that are in the Mailigen contact list will be the recipients of the campaign email created from the Customer Letter.
Sending a letter from SERP
In order to create Activities with the recipients of the Customer Letter as the contacts, add an Activity Type in the Mailigen settings.
If a campaign has been created from the Customer Letter (Campaign status has to be "Campaign Created". If the Status is "In Progress", run maintenance "Mailigen campaign check" (button in Customer Letter)) and it is OKed, Activities will be created for all of the recipients of the Customer Letter that currently match all of the criteria.
- First, in Mailigen, create a template you will use to format this e-mail. You can create one from scratch or use their provided templates, but the main thing is that you need to have a code of the template without any spaces and in capital letters. For this example I will use one called USER-PASSWORDS:
- Create a new letter in CRM > Registers >> Customer Letters
- To send the letter to a specific contact, select the contact in the Customer field. To send the letter to all contacts, input an asterisk "*"
If you wish to filter the recipient contacts by category, select either a specific contact category or input an asterisk "*" to send the e-mails to all categories
If the field Category has * in it and the field Include only categories is defined in the Mailigen Settings, e-mails will be sent only to these categories
- You cannot create a Mailigen campaign from a Customer Letter, if the contact category is indicated and does not match any of the ones defined in the Mailigen Settings Include only categories field
- To send the letter to a classification list, choose the corresponding list name from the dropdown in the Mailigen Classification List field
- Choosing a classification list will automatically filter the contacts using the corresponding list classifications
- If you leave this field blank, the letter will be sent to the main list defined in the Mailigen Settings
- If applicable, select one or more classifications to filter down the contacts accordingly
- Enter the subject of the email in the Header field
- Enter the template name from above in the field Form Template (e.g. USER-PASSWORDS)
- Select the person that should be placed in the Reply to of the email in the Reply To (Email) field
- To check which contacts will be the recipients of the letter, use Operation > Letter List
- Run Operations > Create Mailigen campaign. This will create a campaign in Mailigen with the title from the Header field
- Along with the Campaign, one or multiple contact segments will be created, which titles are the Customer Letter number (field No.). These segments are used as the contact lists for the Campaign
- After the operation, the field Mailigen Status will change from N/A to In Progress.
- Due to different business checks we can't send the campaign immediately, so to check if the campaign has been created successfully, press the button Mailigen campaign check
- If everything went well, there will be a popup message, and the status of the letter will change to Campaign created
- If not, check the troubleshooting section to check what might have gone wrong
- Click the Open Mailigen campaign button to go to Mailigen and send the campaign
- Once the campaign is done, check OK in the letter to indicate that it has been done
- If there is an Activity type indicated in the Mailigen Settings, then activities will be created for all of the recipients of the Customer Letter that currently match all of the criteria
How to set up the Mass Mail package on server
These are main steps for setup:
- Install nodejs (for example: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html)
Link mailigen folder to SERP root folder for example
ln -s git/mailigen mailigen
- Install node package in the mailigen folder (for example npm install xmlhttprequest)
- Add needed HAL rules
- In SERP set up Timed Event MassMailCheckMn that will periodically update campaign status from Mailigen (i.e. is it created)
- Add Mailigen settings in CRM > Settings > Mailigen Settings
- Script runner - node (or full path to node, if just node does not work)
- Campaign file location path - location, where the generated campaign and other informational files will be located. These indicate, which campaigns have been created. Example - tmp-mailigen/. The folder must exist!
- Mailigen file location path - location, where the Mailigen code execution files are located. In a previous step, the git/mailigen folder was linked to mailigen, so this should be mailigen/
- API key - From Mailigen > Settings > API keys
- Authentication key - should match the parameter "key" defined in Webhook call URL
- Main List Web ID - Mailigen contact list ID, that can be found in the URL, when the appropriate list is opened (https://admin.mailigen.com/contacts/dashboard/?id=XXXXXX, where X is a number)
- Activity type - Activity type for activities that will be created for all of the recipients of the Customer Letter after Letter is OKed
Troubleshooting
- mailigen-debug.log file located in the server root contains information from the requests made and passed data. If there were any errors with a request, they will be displayed here
- So if something did not work/happen, check mailigen-debug.log first
- If mailigen-debug.log file is present, but is empty, there might be a problem with either the script, or the running of the script. To check this, run the script manually:
- In the server root run node mailigen/script.js (if node is the script runner and the symlinked mailigen folder from git was named mailigen) - this will most likely display any errors with the running of the script
- If the mailigen-debug.log file is present and is not empty, but has old data in it (e.g from a previous request), then that means that the script has not been called from HAL
- If so, first check in the server console if there are both output messages:
Mailigen request is processing ... (Wait for a success message)
Mailigen request completed
- If not, then that means the script failed to execute
- If both messages were present on the server console, next you have to check if a mailigen.json file is created in the mailigen/ folder with the latest request data (If making a campaign, check the letter No., if adding an email to a list, check the email)
- If so, this means that the HAL side has worked, but the script has not been run. Check if the Script runner and Campaign file location is defined correctly. The folder must exist beforehand
- To check whether the Script runner and Campaign file location is defined correctly, run the script manually in the server root using the defined Script runner (e.g node mailigen/script.js). If it executes without errors, but it does not work when running from the Letter, then that means that the Script runner is defined incorrect
- On a successful run, a file should be made in the defined Campaign file location (mailigen_campaign_letterNr_timenow.txt)
- If so, first check in the server console if there are both output messages: