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

# Morf Form Setup Instructions

> Step-by-step instructions for connecting your forms to workflows via webhooks.

## 1. Access Morf webhook URLs

You'll need the **staging** and **production** webhook URLs from the workflow that should receive Morf form submissions.

**How to access your webhook URL:**

1. Navigate to your **Feathery-triggered workflow** and open build mode.
2. Click the **trigger node**.
3. Open the **"Connect"** section.
4. Copy the **Webhook URL**. It will start with `https://api.morf.healthcare/webhooks/`

## 2. Register Morf webhooks in Feathery

In your form, go to **Integrations > Webhooks**:

1. Click **Add destination**.
2. Set **Send data when** to `Any user data is received (e.g. step submission)`.
3. Check **Include hidden fields in events**.
4. Set **URL** → your production webhook URL.
5. Set **Test URL** → your staging webhook URL.

**Publish your form.** In order to test the webhook successfully and see events show up in Morf, you must publish the form using the button in the top right corner.

## 3. Add hidden fields

> [!TIP]
>
> If using the Morf patient sign-up template, these hidden fields are already included.

In the form, go to **Settings > Data Tracking > Edit Hidden Fields** and add:

* `morf_org_id`
* `morf_webhook_url` *(if using Morf scheduling UI)*
* `appt_type_id` *(if using Morf scheduling UI)*
* Any other organization-dependent variables

## 4. Conditionally set hidden field values

Use a **custom logic rule** to initialize your hidden fields based on whether the form is running in test mode (staging) or live mode (production).

1. Go to **Logic > Create New Logic Rule**.
2. Name your rule `Set Environment Variables`.
3. Configure the trigger:
   * **Event trigger:** Form Step is Loaded
   * **Step trigger:** the first step in your form
4. Go to **Advanced Logic > Edit Code** and add the code below, replacing the placeholder values with your own org IDs, appointment type IDs, and webhook URLs.

> [accordion] View code
>
> ```jsx theme={null}
> if (feathery.isTestForm()) {
>   // STAGING
>   morf_org_id.value = 'bffa1f46-e724-481c-8e4d-635728d3da58'; // your staging org id
>   morf_webhook_url.value =
>     'https://api.morf.healthcare/webhooks/8cbe4b21-9922-4e4a-8d4c-0ff74f876c74'; // staging workflow trigger webhook url
>   appt_type_id.value = '40983'; // your appointment type id from Healthie staging
> } else {
>   // PRODUCTION
>   morf_org_id.value = '7c114b98-3604-4e46-92ea-29299184ba78'; // your production org id
>   morf_webhook_url.value =
>     'https://api.morf.healthcare/webhooks/8cbe4b21-9922-4e4a-8d4c-0ff74f876c74'; // production workflow trigger webhook url
>   appt_type_id.value = '40983'; // your appointment type id from Healthie production
> }
> ```

> [!TIP]
>
> Access your Morf organization ID by logging into the Morf dashboard, select your staging or production organization, and copy the alphanumeric UUID from `https://dashboard.morf.health/<organization-id>`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.