# Use case 3: Mailmodo's Send Campaign Email API

Mailmodo makes your email marketing easy with automated emails which can be personalised with relevant information with custom templates to engage the right audiences. With Mailmodo you can send AMP emails like form submissions and subscriptions and receive the data directly to the platform you integrated.

Mailmodo integration in Lemnisk will help you to make email engagements directly from the platform through Mailmodo by passing data to the Mailmodo API. This demonstration helps you configure Mailmodo's email API with Lemnisk. As every engagement in Mailmodo demands a different payload, the payload value will be configured at the engagement level.

## Prerequisites

**API Docs / Reference doc:** [https://www.mailmodo.com/developers/4c44d1b19765f-send-campaign-email/](https://www.mailmodo.com/developers/4c44d1b19765f-send-campaign-email/)

**Valid Authorization scheme and keys:** Depending on your free/paid account with your external system, OR your internal tech implementation of the API, you should have the relevant authorisation mechanism and its keys/passwords/tokens handy. Your POC from the external vendor or your tech team shall help you with the same

{% hint style="info" %}
The API URL and the payload will be provided by the Mailmodo team.
{% endhint %}

## Configuring Mailmodo' Send Campaign Email API in Lemnisk

Go to > Campaigns > Channels > External API

**Step 1:** Click the **+Add New External API** Button

<figure><img src="https://1782533751-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FazJDZwzHkmWIbkYOetQH%2Fuploads%2FnzGF08MXSd9UgIHsXN7m%2Fimage.png?alt=media&#x26;token=f94a7627-c5d5-4858-b634-d6f04174de2a" alt=""><figcaption><p><em>Image: Add New External API</em></p></figcaption></figure>

**Step 2:  Add Basic Details**

* **Name:** Name the configuration as **Hubspot\_CreateContacts**
* **Description:** Enter the description of your API.
* **Channel:** Choose the channel you want the API to communicate with your audience. Here we choose Email as our preferred channel.

**Step 3: Add External API Details**

**HTTP Method:** Here we select POST as the HTTP Method as the API is a post request to add contacts emails in the Hubspot database.

**URL:** Paste the following API URL [https://api.mailmodo.com/api/v1/at/c/\{{CAMPAIGN\_ID\}}](https://api.mailmodo.com/api/v1/at/c/%7B%7BCAMPAIGN_ID%7D%7D)

You can add parameters by creating variables at the end of the URL and declaring value inside \{{value\}} double curly braces. Here we added the parameter \{{CAMPAIGN\_ID\}}in the URL and configured its default values which can be changed later while creating an engagement.&#x20;

<figure><img src="https://1782533751-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FazJDZwzHkmWIbkYOetQH%2Fuploads%2F4JGZLHespo4jd83kAXOm%2Fimage.png?alt=media&#x26;token=9f009949-2a61-4699-adf0-6f0382f734ed" alt=""><figcaption><p><em>Image: URL Path Parameters</em></p></figcaption></figure>

**Headers:** Add Headers to provide the metadata about the request. Here we added the authorization and API key in the headers to authenticate the API. The API key will be provided by the Mailmodo team.

<figure><img src="https://1782533751-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FazJDZwzHkmWIbkYOetQH%2Fuploads%2FER92IR07x7KdAavg8bKL%2Fimage.png?alt=media&#x26;token=0a897d55-a95f-43d3-8d4f-a486fbf26aaf" alt=""><figcaption><p><em>Image: Headers</em> </p></figcaption></figure>

**Step 5:** Once all the fields are configured, click **Save Details.**

{% embed url="https://drive.google.com/file/d/1I6N_FJLSt57aUQr0zTPtk8mHqjPNtQJ7/view?usp=sharing" %}
_Demo: Configuring Mailmodo's send campiagn email API_
{% endembed %}

## Creating Engagement in Mailmodo's Send Campaign Email API

**Step 1: Create an Engagement**

{% tabs %}
{% tab title="Method 1 - Segment" %}
* Go to Campaigns > Segments
* Select the Segment Name
* Click on External API on the left panel
* Click on the **+Add Engagement** Button&#x20;
{% endtab %}

{% tab title="Method 2 - Channel" %}
* Go to Campaigns > Channels
* Click on External API on the left panel
* Click on Add Engagement
* Select Segment Name from the list
* Click on Confirm And Proceed To the Next Step
{% endtab %}
{% endtabs %}

**Step 2: Add General details**

* **Engagement Name (mandatory):** We named the Configuration as Mailmodo
* **API(mandatory):** Selecting our API as Mailmodo
* **Label (mandatory):** Choose a product label from the list. Click [here](../../../getting-started#product-label) to learn more about **Product Label**.

**Step 3: Add a Goal** \
**Goal Type:** Here we have selected the goal type as none.

**Step 4: Configure Parameters**

**URL path parameters:** This will be updated automatically as you defined in the URL path parameter while configuring the API.

**Payload:** Hence we configured the API in engagement level, the payload will be added in this part in every engagement.&#x20;

```json
{
  "email": "@EMAIL@",
  "data": {
    "first_name": "${LEAD_LASTNAME}"
  }
}
```



```json
{
  "email": "@EMAIL@",
  "data": {
    "first_name": "${LEAD_LASTNAME}"
  }
}
```

Add the values for the variables declared in the payload&#x20;

<figure><img src="https://1782533751-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FazJDZwzHkmWIbkYOetQH%2Fuploads%2Fc051eHmb3oe863YeSqke%2Fezgif.com-video-to-gif-converter%20(5).gif?alt=media&#x26;token=5e634f0f-ca1b-4b55-86bd-b0e9f821c740" alt=""><figcaption><p><em>Gif: Configuring parameters</em></p></figcaption></figure>

Here we have another payload example which varies at the engagement level.

The following payload has the variable only for email.

```json
{
  "email": "@EMAIL@"
}
```

<figure><img src="https://1782533751-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FazJDZwzHkmWIbkYOetQH%2Fuploads%2FIv6U8XZzrl4ZUDOqAKlh%2Fimage.png?alt=media&#x26;token=08467c49-8f0b-45a5-ae09-8f919df8e198" alt=""><figcaption><p><em>Image: Payload</em> </p></figcaption></figure>

**Step 5: Schedule Settings**\
You can schedule an engagement to trigger immediately or to send later by configuring the Time and Date. Here we have selected the schedule as immediate.

**Step 6**: Click "Save"

{% embed url="https://drive.google.com/file/d/1D4_jeP5EDpRX5pGo0ZLmXU2ZlQGJRjdb/view?usp=sharing" %}
_Demo: Creating Engagement in Mailmodo_
{% endembed %}
