# Creating a Process with HTTP Trigger

This guide explains how to create a simple Frends Process that acts as an HTTP endpoint, callable from external systems. The example Process will consist of only an HTTP Trigger and a Return shape, immediately sending a response back to the caller. We will secure this endpoint using an API Policy, which allows for centralized authentication management using methods like API keys.

## Prerequisites

Before you begin, you will need access to a Frends Tenant where you have permissions to create Processes and manage API Policies in the API Management section.

## Create the Process

First, we will create a new Process and add the necessary shapes to the canvas. All new Processes are created and edited in the Development environment.

Navigate to the Process list view and ensure the **Development** environment is selected. Click the **Create New** button to open the Process editor. Give your Process a descriptive name, for example, "Simple HTTP Endpoint".

The Process canvas will open with a default Trigger shape. We will change this to an HTTP Trigger. After that, we will add a Return shape and connect the two.

1. Click on the default Trigger shape on the canvas. In the right-side panel, change the Trigger type to **HTTP Trigger**.
2. From the toolbar on the left, drag a **Return** shape onto the canvas to the right of the HTTP Trigger.
3. Connect the two shapes. You can use the **Connect tool** from the toolbar or hover over the Trigger shape to use the quick toolbar, then draw a line from the HTTP Trigger to the Return shape.

Your Process should now have a simple flow: an HTTP Trigger connected directly to a Return shape.

<figure><img src="/files/bccS3oeX96E4ESp5xaCg" alt=""><figcaption><p>Minimal example Process for HTTP Trigger.</p></figcaption></figure>

## Configure the HTTP Trigger

The HTTP Trigger is the entry point for our Process. It listens for incoming HTTP requests that match its configuration.

Select the HTTP Trigger on the canvas to open its settings in the right-side panel.

### Define the Endpoint

First, define the method and URL for your endpoint.

* **HTTP method**: Choose the HTTP method the endpoint should respond to. For this example, let's select `GET`.
* **URL**: Set the URL path for the endpoint. This path will be appended to the Development environment's base address. Let's use `hello/world` for the example. Note that the URL should not start with a slash.

### Set Authorization to API Policy

In the **Authorization** section of the Trigger settings, select `API Policy` from the dropdown menu.&#x20;

This configuration tells Frends that authentication for this endpoint will be handled by the rules defined in API Management, rather than being configured directly on the Trigger itself. This is the recommended approach for managing access to your API endpoints.

Leave the other settings like **Allowed protocols** and **CORS** at their default values for this guide.

<figure><img src="/files/5axPZ5CTNnrS8Ycg8o5z" alt=""><figcaption><p>Standard HTTP Trigger configuration for the usual use cases.</p></figcaption></figure>

## Configure the Return Shape

The Return shape concludes the Process execution and, in this case, sends an HTTP response back to the system that called the endpoint.

Select the Return shape on the canvas to open its settings.

1. Set the **Return type** to `HTTP Response`. This provides specific fields for crafting a standard HTTP response.
2. **Status Code**: The default value `200` indicates a successful execution.
3. **Body**: Enter the content you want to return. For this example, you can enter a simple JSON object like `{"message": "Hello from Frends!"}`.
4. **Content Type**: Set this to `application/json` to match the body content, if not set by default.

<figure><img src="/files/ZU3oFg44dQ5egs9Z6BZD" alt=""><figcaption><p>Example HTTP response configuration for Return shape.</p></figcaption></figure>

After both the Trigger and the Return shape are connected and configured, and the Process has a name, save the Process. We will next configure the API Policy in order to be able to call the HTTP endpoint we just defined.

## Create the API Policy

Now that the Process is configured, we need to create an API Policy to grant access to the endpoint. Without a matching policy, all calls to the endpoint will be denied.

Navigate to **APIs >** **API Policies** in the main menu. Click **Create new** API Policy.

### Define the Policy and Target

Give the policy a name, such as "Hello World Dev Policy". If you are making a Public Access policy, it's also good to mention on the policy name, such as "Hello World Dev Public Access".

In the **Targeted endpoints** section, you need to define which endpoint this policy applies to. The method and path must match what you configured in the HTTP Trigger.

* **Method**: Select `GET`.
* **Path**: Enter `/hello/world`. Note that in the API Policy editor, the path should start with a slash.

The Path field will also suggest existing API endpoints to add to the Policy as a dropdown menu, but it will not list the defined HTTP Trigger URLs. Instead, you can write the exact path for it and click on "Create /hello/world" from the dropdown menu.

<figure><img src="/files/7O568KPxIQJREX4GEw3M" alt=""><figcaption><p>API Policy endpoints can be written by hand to include any URL paths.</p></figcaption></figure>

### Authentication

API Policies can be used with different access options depending on the use case. For example, an endpoint can be protected with an API key for system-to-system calls, OAuth or Private Application token authentication for token-based access, or public access when authentication is not required. The exact authentication choice depends on how the endpoint is intended to be used and who should be allowed to call it. Although the options say API key or API authentication or API Policy, these all apply to HTTP Trigger endpoints as well.

For this guide, configure the API Policy to allow public access in the Development Environment. This makes the endpoint easy to test, without worry about the format or fields for authentication method.&#x20;

<figure><img src="/files/rP6WDfoVe0H1RI6XXmu7" alt=""><figcaption><p>Public access configured for default Development Agent Group.</p></figcaption></figure>

Save changes after configuring the API Policy.

## Activate the Process in Development

After the Process and API Policy are configured, activate the Process Trigger in the Development Agent Group. This makes the HTTP Trigger available for incoming requests handled by the Development Agent.

Return to the Process list in the Development Environment and select the Development Agent Group. Open the Actions menu for the Process and click **Activate** to activate the HTTP Trigger. Once active, the Trigger can start new Process Instances when matching HTTP requests are received.

## Find the Development Agent URL

To call the endpoint, combine the Development Agent's base URL with the HTTP Trigger URL path.

You can find the Development Agent's base URL from Environment Administration. Open the Development Environment and view the Development Agent's details. The external address shown there is the base address used for HTTP endpoints in that Agent Group.

For example, if the Development Agent base URL is:

```
https://example-dev-agent.frendsapp.com:443
```

and the HTTP Trigger URL path is:

```
hello/world
```

the full endpoint URL is:

```
https://example-dev-agent.frendsapp.com:443/hello/world
```

Alternatively with the HTTP Trigger active, by opening the Agent log view, you can also find the active Triggers on that Agent. Each HTTP or API Trigger will also display the Process's URL directly here.

<figure><img src="/files/AbjliTEbrFaWGnwjVEUW" alt=""><figcaption><p>Active Triggers on an Agent in Environment Administration view.</p></figcaption></figure>

You can call this URL using Postman or curl applications to test the endpoint.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.frends.com/guides/development/creating-a-process-with-http-trigger.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
