How to Set Up an Activation Flow?

Use the Activation Flow template to quickly set up and test new flows, webhooks, and routing logic in Fastn.

Overview

The Activation Flow is a template that helps you automate project activation. You can use it as a test run or adapt it for specific tasks. This template is available in the Templates section of your workspace, and you can import and customize it directly.

This guide walks you through the steps inside the template so you understand what each part does and how to modify it.

1. Flow Initialization

The flow begins with a Request step, which acts as the entry point for the activation flow. This step captures the headers and the input payload that will be passed along to the subsequent steps.

By default, this template is designed to start on a new API request, but you can configure the starting point differently depending on your use case.

2. Initialize Your Flow Variables

The second step is a Variable step named “initiate your flow variables.”

Purpose

  • To initialize key variables that will be reused throughout the flow.

  • This includes:

    • Headers (e.g., headers.fastn_project_id)

    • Import templates object

    • Webhooks object

By standardizing these variables early on, the rest of the flow can reference them consistently without redefining values.

3. Switch Step: Tenant Exists?

Before moving into template and webhook loops, the flow checks if the tenant exists.

  • If the tenant does not exist → return an error message response immediately.

  • If a tenant exists → continue into the next stages (looping through templates and webhooks).

This ensures the flow only proceeds when a valid project/tenant is present.

4. Loop Over Templates

This step iterates through all the templates that may need to be activated.

Inside the loop

  • Get API step → checks if a flow already exists.

    • header.projectId = {{var.headers.fastn_project_id}}

    • id = {{steps.loopOverTemplates.loopOverItem.flow_name}}

  • Switch step → if the flow does not exist, create it using an Import Flow Copy step.

    • header.projectId = {{var.headers.fastn_project_id}}

    • body.organizationId = community

    • body.templateId = {{steps.loopOverTemplates.loopOverItem.template_id}}

    • body.deployTo = LIVE

    • body.flowName = {{steps.loopOverTemplates.loopOverItem.flow_name}}

5. Loop Over Webhooks

Once templates are processed, the flow iterates through webhooks.

Inside the loop

  • Get Webhook step → checks if the webhook exists.

    • webhookId = {{steps.loopOverWebhooks.loopOverItem.resource_name}}

    • header.projectId = {{var.headers.fastn_project_id}}

  • Switch step → if the webhook does not exist, create it with schedules and routes:

  • header.projectId = {{var.headers.fastn_project_id}}

  • body.schedule.payloadJson = Field value

  • body.schedule.rate.time = {{steps.loopOverWebhooks.loopOverItem.schedule_time}}

  • body.schedule.rate.unitTime = {{steps.loopOverWebhooks.loopOverItem.schedule_unit_time}}

  • body.schedule.name = {{steps.loopOverWebhooks.loopOverItem.resource_name}}

  • body.schedule.type = {{steps.loopOverWebhooks.loopOverItem.schedule_type}}

  • body.schedule.flowId = {{steps.loopOverWebhooks.loopOverItem.flow_name}}

Routes configuration

  • headers = {{steps.loopOverWebhooks.loopOverItem.routeHeaders}}

  • routeId = {{steps.loopOverWebhooks.loopOverItem.flow_name}}

  • flowId = {{steps.loopOverWebhooks.loopOverItem.flow_name}}

Additional configurations

  • Auto-generate API key → Yes/No

  • DLQ configurations (e.g., retries = 1)

  • Webhook authentication → Yes/No

6. Success Response

The final step is a Response step, which returns a success message.

  • This confirms that templates have been imported (if needed) and webhooks have been created or validated.

  • You can fully customize this response.

Flow Logic Recap

  1. Request step → Variable step → Switch (tenant exists?)

    • If tenant missing → Error

    • If tenant exists → Continue:

  2. Loop over templates → Import missing flows

  3. Loop over webhooks → Create missing webhooks + routes

  4. Return success response.

Last updated

Was this helpful?