Drupal Middleware

Connecting subscription forms in Drupal to Maileon can be done by setting up a WebForm and a handler.

However, since field names in WebForms 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

Name

Value

Description

Name

Value

Description

Content-Type

application/x-www-form-urlencoded

The middleware accepts standard form POST inputs. For this, a specific content type header must be send with each request.

Parameter

Name

Required / Optional

Default

Description

Type

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:
1: None
2: Single-Opt-In
3: Confirmed-Opt-In
4: Double-Opt-In
5: Double-Opt-In with single user tracking
6: Other

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 DOI attribute “subscriptionPage” (and/or the DOI attribute “source = Drupal”).

String

email

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.

String

fullname

Optional

 

The contact’s full name. May also be defined by using the standard field mapping.

String

firstname

Optional

 

The contact’s first name. May also be defined by using the standard field mapping.

String

lastname

Optional

 

The contact’s last name. May also be defined by using the standard field mapping.

String

mapping_standard_fields

Optional

 

E.g.: {"FieldNameInForm1": "FieldNameInMaileon1", "FieldNameInForm2": "FieldNameInMaileon2"}

JSON

mapping_custom_fields

Optional

 

E.g.: {"FieldNameInForm1": "FieldNameInMaileon1", "FieldNameInForm2": "FieldNameInMaileon2"}

JSON

<additional-fields>

Optional

 

Any additional fields that are being mapped in one of the above mappings.

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.

Fig. 1: Add a new form element

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”.

Fig. 2: Complete form in WebForms

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.

A list of all available standard fields in Maileon can be found in the documentation.

Example:

{ "Field in WebForms": "Field in Maileon", "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.

Fig. 3: Defining a mapping

WebForm handler configuration

Finally add a “Remote Post” handler to send submitted form data to the middleware.