---
title: Creating a custom action
slug: tesco-hol-q12026/creating-a-custom-action
docTags: 
createdAt: 2024-01-30T23:03:21.354Z
---

## Introduction

We want to use an external service to get the current weather of a city. For this lab, we will be using a service from [openweathermap.org](https://openweathermap.org/current?collection=current_forecast\&collection=current_forecast\&collection=current_forecast\&collection=current_forecast#name)

:::hint{type="info"}
To open Adobe Journey Optimizer, click on nine dots on the top bar and select&#x20;**&#x20;Journey optimizer**. Check the [Welcome](docId\:JWtqayULjuViBBU3-XHju) section.
:::

## Actions overview

To get an overview of all actions in Adobe Journey Optimizer:

In the menu on the left side, under **Administration**, click on **Configurations**. You will see a set of tiles. Click on **Manage** in the **Actions** tile to get an overview with all existing events.

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/xjY4DOC-R89gI3igEeLtZ_screenshot-2026-02-18-at-044926.png)



## Configuring an action

We'll be configuring an event that we can use in our journey. The event should trigger whenever a customer books a flight.

To configure a new event, click **Create Action**. A menu will open on the right side.

### Action metadata

1. Set the **name** to  `yourname_weatherAPI`.
2. Enter a **Description** (optional).
3. Keep Action Type as **Custom.**
4. Keep Channel as **Other**.
5. Keep Required marketing action as **None**.

::Image[]{src="https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/pANwfDeTtynoZJ6uPylq9_screenshot-2026-02-18-at-050351.png" size="40" width="934" height="1352" position="center" darkWidth="934" darkHeight="1352" showCaption="false"}



### Endpoint configuration

1. Enter URL as `http://api.openweathermap.org/data/2.5/weather`
2. Select Method as **GET**
3. **Keep** both the headers for Content-Type\:application/json and Charset\:UTR-8 as such.
4. Click **Add a query parameter field.**
   1. Enter the query parameter name as **`q`.**
   2. Select the type as **Variable.**
5. Click **Add a query parameter field&#x20;**&#x61;gai&#x6E;**.**
   1. Enter the query parameter name as **units.**
   2. Select the type as **Constant.**
   3. Enter the Value as `metric`.

::Image[]{src="https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/PqiOanPxi_P4O5YkplJ2n_screenshot-2026-02-18-at-051034.png" size="60" width="930" height="1122" position="center" darkWidth="930" darkHeight="1122" showCaption="false"}

### Authentication

1. Select Type as **API key**.
2. Enter Name as `apiKey`
3. Enter Value as `ed89eda737a7618a502b1f6600e26f7a`
4. Keep the Location as **Query parameter**.

::Image[]{src="https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/2HiUn9si8n-IrWQgJBR1L_screenshot-2026-02-18-at-050724.png" size="60" width="934" height="664" position="center" showCaption="false"}

### Payloads

Click on **0 fields selected** or :FontAwesome[]{icon="fa-solid fa-pen"}**-icon** next to it to open a pop up to configure the fields.

::Image[]{src="https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/Kgb61cSDUbP4LbduDedxv-20260218-051429.png" size="100" width="2958" height="1484" position="center" showCaption="false" indent="2"}

**Copy** the below API response structure and **paste** the payload(Cmd+V in mac)

:::BlockQuote
\{
&#x20; "coord": \{
&#x20;   "lon": -2.15,
&#x20;   "lat": 57
&#x20; },
&#x20; "weather": \[
&#x20;   \{
&#x20;     "id": 804,
&#x20;     "main": "Clouds",
&#x20;     "description": "overcast clouds",
&#x20;     "icon": "04d"
&#x20;   }
&#x20; ],
&#x20; "base": "stations",
&#x20; "main": \{
&#x20;   "temp": 8.48,
&#x20;   "feels\_like": 4.9,
&#x20;   "temp\_min": 8.18,
&#x20;   "temp\_max": 9.26,
&#x20;   "pressure": 1016,
&#x20;   "humidity": 79,
&#x20;   "sea\_level": 1016,
&#x20;   "grnd\_level": 1016
&#x20; },
&#x20; "visibility": 10000,
&#x20; "wind": \{
&#x20;   "speed": 7.3,
&#x20;   "deg": 189,
&#x20;   "gust": 13.48
&#x20; },
&#x20; "clouds": \{
&#x20;   "all": 100
&#x20; },
&#x20; "dt": 1647347424,
&#x20; "sys": \{
&#x20;   "type": 2,
&#x20;   "id": 2031790,
&#x20;   "country": "GB",
&#x20;   "sunrise": 1647325488,
&#x20;   "sunset": 1647367827
&#x20; },
&#x20; "timezone": 0,
&#x20; "id": 2641549,
&#x20; "name": "Newtonhill",
&#x20; "cod": 200
}
:::

You should see the field configuration automatically picks up the response structure and assign the field types. Keep everything as default and click on **Save**.

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/zpy1KQvm_2AgP0oH1sPdE_screenshot-2026-02-18-at-051553.png)

Your screen should look like the image below. **Scroll up** to the top and click on **Save** button on the top right corner.

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/A0CsvdWO5pvhVT-R0QTQg_screenshot-2026-02-18-at-052149.png)

:::hint{type="success"}
​You have successfully created a custom action which will get current weather in a city that will be sent as a query parameter.
:::

