---
title: "Personalize Messages Based On Weather In Your Contact's Location"
slug: "personalize-messages-based-on-weather-in-your-contacts-location"
updated: 2024-03-27T10:17:23Z
published: 2024-03-27T10:17:23Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Personalize Messages Based On Weather In Your Contact's Location

The HTTP connector allows you to send different messages depending on the weather in the customer's location.

> [!TIP]
> This article only shows one of countless possible scenarios. Build your own creative nurture paths with the HTTP connector in Mapp Engage!

## Scenario

You want to send emails to your contacts depending on the temperature in their location - two different email versions for above and below 5 degrees Celsius. Additionally, you want to set a path for when a request fails.

## Prerequisites

To follow the scenario, Mapp Engage has to be activated and configured.

"City" has to be available as custom attribute.

## A) Set up connection with OpenWeather API.

1. Go to [home.openweathermap.org/users/sign_up](https://home.openweathermap.org/users/sign_up) and create an account.
2. You will receive a confirmation email including your API key and details about using the API. The [How to Start](https://openweathermap.org/appid) documentation can also help you with this.
3. Now you can [create a new record in the Credential Store](https://help.mapp.com/Help.en_GB/Help.htm#create-new-record-window.htm%3FTocPath%3DMapp%2520Engage%7CAdministration%7CPermissions%7CCredentials%7C_____3). This will allow Engage to connect to the OpenWeather API. To create this record, you will need the relevant API call and your API key. You can find examples of API calls and the relevant parameters [here](https://openweathermap.org/current).

## B) Create Whiteboard in Engage

1. Create an event-based Whiteboard: *Automations > Whiteboard NEW > Create > Event-based*.
2. Set the entry event to define when the whiteboard should be triggered. In our example we use **Enters Group**, and select the group.

> **Enters Group** is an Event in the Whiteboard. Engage registers this event when a new contact joins a group. This includes contacts added manually, via an automation, or with certain API methods. For more information, see [Enters Group (Whiteboard Event)](https://help.mapp.com/Help.en_GB/Help.htm#enters-group-event-whiteboard-new.htm).
3. As a next step, we connect with OpenWeather and send the city where the user lives.
  1. Add the job **Send HTTP Request**. ![](https://cdn.document360.io/554b9b98-6720-4d8b-9919-c7b203d72648/Images/Documentation/e3ef8ad6-c961-49d7-80e1-5e1d5b9b5a5d.png)
  2. Select the API connection that you configured in the Credential Store from the drop-down list under **Credential Store Record**. Select the **GET** **Method**and **UTF-8** encoding. ![](https://cdn.document360.io/554b9b98-6720-4d8b-9919-c7b203d72648/Images/Documentation/a73c5498-0160-4241-8748-4fb1c8654a43.png)
  3. Click **Add** **Parameter**. OpenWeather uses the "q" parameter for the name of the city.
    1. Use "q" as parameter name.
    2. Select defined value.
    3. Add the value. In this case, the value is a Custom Attribute that defines the city: ${user.CustomAttribute[‘cityName’]}. If you don't have this Custom Attribute defined, see how you can do that [here](/v1/docs/create-custom-attribute).
    4. Click **Save** **Parameter**. ![](https://cdn.document360.io/554b9b98-6720-4d8b-9919-c7b203d72648/Images/Documentation/2871245b-2363-4184-a0df-ad9d10db0986.png)
    5. Click **Apply**. ![](https://cdn.document360.io/554b9b98-6720-4d8b-9919-c7b203d72648/Images/Documentation/d52bbf58-c548-4d68-8e59-e9fa18ca2105.png)
4. Configure the **HTTP Response Body Parser** to use the parameter values received from the server. In our example we get the temperature of our contact's city.
  1. Select **JSON**from the drop-down list.
  2. Click **Add Parser**. The **Parser Settings** window opens.
  3. Insert the parsing formula. You will find the Weather fields in the API response [here](https://openweathermap.org/current#current_JSON). Our example only uses the **temperature** ($.main.temp), but there is more detailed weather information that you could get from the site.

> [!TIP]
> Use the [JSONPath Online Evaluator](https://jsonpath.com/) to check the validity of your parser formula.
> 
> 1. Copy the example API response from [here](https://openweathermap.org/current#current_JSON).
> 2. Paste it in the left panel of the [online evaluator](https://jsonpath.com/).
> 3. Paste the parameter in the JSONPath Syntax field.
> 4. Check results on the right panel.
  4. Add a name for parameter (here: "Temperature"). Click **Save** **Parser**. ![](https://cdn.document360.io/554b9b98-6720-4d8b-9919-c7b203d72648/Images/Documentation/3ed3d130-abcd-4288-9f04-d1936c42b303.png)
  5. Click **Apply**. ![](https://cdn.document360.io/554b9b98-6720-4d8b-9919-c7b203d72648/Images/Documentation/9d38243d-72a7-40a7-929a-dfeda62f15f8.png)
5. Add a **Multiple Event** to differentiate the flow. In our case, there are three different paths. Each of the paths is using the job **HTTP Response Received**. Define the conditions in your paths.
  1. **Path 1**: The response from the server was successful (HTTP Response Status range from 200 to 299) and the temperature is above 5 degrees Celsius.
    1. Click Add Event and select **HTTP Response Received**.
    2. Under HTTP Response Status select **Status Range**.
    3. Enter **Value from: 200**, and **Value to: 299**.
    4. Under **HTTP Response Parameter** select **Specific Parameter**. ![](https://cdn.document360.io/554b9b98-6720-4d8b-9919-c7b203d72648/Images/Documentation/545f5a34-b219-4c70-af0b-2163547b074e.png)
    5. Click **Add Criteria** and enter details: Select the **Criterion***Temperature*, the **Operator** *Is Greater Than*, and the **Value***5*. Click **Save Criteria**. ![](https://cdn.document360.io/554b9b98-6720-4d8b-9919-c7b203d72648/Images/Documentation/f05ea5bd-286d-47ae-91f4-aa760bfb2db1.png)
  2. **Path 2**: The response from the server was successful (HTTP Response Status range from 200 to 299) and the temperature is below 5 degrees Celsius.
    1. Click Add Event and select **HTTP Response Received**.
    2. Under **HTTP Response Status** select **Status Range**.
    3. Enter **Value from: 200**, and **Value to: 299**.
    4. Under **HTTP Response Parameter** select **Specific Parameter**.
    5. Click **Add Criteria** and enter details: Select the **Criterion***Temperature*, the **Operator** *Is Less Than*, and the **Value** *5*. Click **Save Criteria**. ![](https://cdn.document360.io/554b9b98-6720-4d8b-9919-c7b203d72648/Images/Documentation/42876393-0f09-4088-ba84-5bc71d1ead9a.png)
  3. **Path 3**: HTTP Response Status is 404 - failed. It is good practice to prepare a fallback email, in case the connection with the OpenWeather API is not succesful.
    1. Click Add Path and select **HTTP Response Received** .
    2. Under **HTTP Response Status** select **Specific Status** and enter Value: **404**.
    3. Click **Save Criteria**. ![](https://cdn.document360.io/554b9b98-6720-4d8b-9919-c7b203d72648/Images/Documentation/09bc9c35-d31e-4a2f-a4ef-bf73aa7286e9.png)
6. Add the job **Send Email**to each path. Now you can select your prepared messages.
7. Click **Apply**and activate your Whiteboard. Done!

![](https://cdn.document360.io/554b9b98-6720-4d8b-9919-c7b203d72648/Images/Documentation/13d79f7c-c168-4fd3-875d-eb519d6d9d5b.png)

## Related Topics

[Email Message Creation](/v1/docs/email-message-creation) [Prepared Messages](/v1/docs/prepared-messages) [Using the HTTP Request Job in the Whiteboard](/v1/docs/using-http-request-job-in-the-whiteboard)
