Connecting subscription forms in Drupal to Maileon can be done by setting up a WebForms Handler.
However, since field names in WebForms Handlers may only contain lowercase letters, a middleware to convert the field names is required.
Subscribe
Endpoint
POST
https://integrations.maileon.com/xsic/ext/drupal/subscribe.php
Header
Name | Value | Description |
---|---|---|
Content-Type | application/x-www-form-urlencoded | Die MIddleware wird aus einem POST-Formular angesprochen, genauer gesagt muss der Content-Type-Header auf „application/x-www-form-urlencoded“ gestellt und die Daten wie üblich als Teil des Bodies übertragen werden. |
Parameter
Name | Required / Optional | Default | Description | Type |
---|---|---|---|---|
api_key | Required | The Maileon API key to access the REST API and to identify the Maileon account. New keys can be created in Maileon under Settings → API Keys. | String | |
permission | Optional | 1 (Permission “None”) | The contact’s permission if no DOI process should be started. Will be ignored and set to the default otherwise. Available permission methods: Check the documentation for further information about all available permission methods. | Integer |
doi | Optional | false | Flag to start a DOI process for a new contact. | Boolean |
tracking | Optional | false | Flag to set allowance for individual user tracking (Opens, Clicks etc.). | Boolean |
doi_key | Optional | An alphanumerical key to identify a DOI mailing to be used in the DOI process. If omitted the account’s default DOI mailing will be used. | String | |
webform_id | Optional | ID of the WebForm. May be used to segment contacts in Maileon by filtering for the “src” attribute. | String | |
Required | The contact’s email address. Can not be part of the mapping parameters listed below. | String | ||
salutation | Optional | The contact’s salutation. May also be defined by using the standard field mapping. | ||
fullname | Optional | The contact’s full name. May also be defined by using the standard field mapping. | ||
firstname | Optional | The contact’s first name. May also be defined by using the standard field mapping. | ||
lastname | Optional | The contact’s last name. May also be defined by using the standard field mapping. | ||
mapping_standard_fields | Optional | E.g.: | JSON-String | |
mapping_custom_fields | Optional | E.g.: | JSON-String |
WebForm configuration
First, the form needs to be created and elements need to be added
While adding an element, it’s key (name in the data model) can be edited by clicking on “edit” next to “key”. See figure 1 below for further information.
Figure 2 displays an example with an email address, a first name and a last name. Additional fields are being converted by using the parameter “mapping_standard_fields”.
The mapping is being defined by a JSON object, in which the object’s attribute name maps the field's name in the WebForm and it’s value maps the field's name in Maileon.
Example:
{ "fname": "FIRSTNAME", "lname": "LASTNAME", "street": "ADDRESS", "zip": "ZIP", "city": "CITY" }
Set the element’s type to “hidden” for all elements that shouldn’t be displayed in the form.
WebForm handler configuration
Finally add a “Remote Post” handler to send submitted form data to the middleware.
You can access the configuration in Drupal under “Settings” → “Emails / Handlers”.