Documentation / Tutorials / Tutorials & How to’s
How to configure aw2.subscribe shortcode to work with third party newsletter service Elastic Email
/ Tutorials & How to’s / How to configure aw2.subscribe shortcode to work with third party newsletter service Elastic Email
This tutorial is about configuring elasticemail.com. You can subscribe to free account to start with.shortcode to capture subscribers to Elastic Email newsletter service. To start with, create an account (free/ paid) of
STEP 1: Create an account of Elastic Email
Screenshot 1: Create an account of Elastic Email
Note: This tutorial does not cover the account creation process. It is left to the reader to follow the process of Elastic Email to create the account.
After the account is created, and you can log in to elasticemail.com and you will see a dashboard from which you can manage right from creating a list to sending newsletters.
Note: The scope of this tutorial is how to configureshortcode to work with Elastic Email to just subscribe to a predefined list.
Screenshot 2: Contacts Section of Elastic Email
Step 2: Create an Elastic Email List
a)To create a list, click on “Contacts” in the main menu, which will open a "Contacts Page". On the right-hand side of the "Contacts Page", there is as "Manage Contacts", menu click on that menu, under which there is a "Create list" menu (as seen in below screenshot).
Screenshot 3: “Create List” Menu under “Manage Contacts“ Tab
After clicking on "Create List" menu, a “Create New List” popup will be presented, enter in the list name and click on the save button.
Screenshot 4: “Create New List” popup
The newly created list is as shown in below screenshot.
Screenshot 5: Newly created List
STEP 3: Get the List Name to use in aw2.subscribe shortcode
Unlike other Service providers, Elastic Email works with list name. Copy the list name as shown in below screenshot.
Screenshot 6: Copy the list name
STEP 4: Get The API key and Public account Id of Elastic Email.
To get the API key and Public account Id of Elastic Email, click on "Settings" Menu under Accounts, after that click on the "SMTP/ API" tab and then copy the required API key and Public Account Id of Elastic Email.
Screenshot 7: The API key and Public account Id of Elastic Email
STEP 5: Example of aw2.subscribe with Elastic Email API
Below code snippet ( generally written as a module ) shows a simple newsletter form which captures subscribers emails to Elastic Email. The code is self-explanatory.
Code Snippet 1: Subscribe to Elastic Email
Note: All the errors messages returned by Elastic Email are internally logged in to PHP error log file.
STEP 6 ( Optional ): Create Custom fields to pass in an additional metadata of subscriber
To add such extra metadata of subscriber in Elastic Email we have to first create the required metadata (called as Contact fields, in the Elastic Email backend)
Following screenshot depicts this,
Screenshot 7: Add Edit Conatc Fields of Elastic Email
Final Notes regarding Elastic Email API
- Please provide the List name correctly. For safer side copy it from Elastic Email Backend, because if the List name is not correct or if there is a slight mistake in the List name, the subscriber would be added to default (unnamed list) instead of the specified List name.For e.g. if the List name is “abcd” and you accidentally passed the parameter as “abc” Elastic Email would not add the subscribed contact to “abcd” list, It would add it to global unnamed list.This issue is not raised when we use global Elastic Email Site settings since the L.ist name is directly pulled from the API of Elastic Email and stored it in site settings (also into site transients ).
- A similar case is for field names of Elastic Email. It handles extra fields differently than other Email service providers. If a custom field is to be added to the subscriber as extra metadata, generally we create a field in the backend first and then use the field name (in lowercase format) in Elastic Email.But again if the field name is slightly mismatched Elastic Email would create a new field with that name. So please carefully pass the field name.
To give an example if there is a field called “mobile_no” in the backend and while passing it is misspelled like “mobil_no”, Elastic Email would create this new field into the backend and will assign the form submitted field data to it. So we have now two fields mobile_no and mobil_no.
That's it for this turial.