Power Automate Integration Guide

Connect ALICE webhook events to Microsoft Power Automate flows. Trigger automated workflows when visitors check in, appointments are created, and more.

1. Create a Webhook Subscription

First, register a webhook subscription with the ALICE API. You will need a valid JWT token and the target URL where ALICE will send events. (You will get the target URL from Power Automate in step 2 below.)

Send a POST request to /api/webhooks with the event type and your endpoint URL:

curl
curl -X POST https://your-api-url/api/webhooks \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "eventType": "appointment.checked_in",
    "targetUrl": "https://prod-00.westus.logic.azure.com:443/workflows/...",
    "description": "Notify on visitor check-in"
  }'

A successful response (HTTP 201) includes the subscription details and a secret for signature verification:

Response (201 Created)
{
  "id": 1,
  "eventType": "appointment.checked_in",
  "targetUrl": "https://prod-00.westus.logic.azure.com:443/workflows/...",
  "description": "Notify on visitor check-in",
  "secret": "whsec_a1b2c3d4e5f6g7h8i9j0...",
  "isActive": true
}
Important: The secret value is shown only once in this response. Copy and store it securely. You will need it if you want to verify webhook signatures.

2. Set Up a Power Automate Flow

Create a Power Automate flow that listens for incoming HTTP requests from ALICE webhooks.

  1. Open Power Automate

    Navigate to https://make.powerautomate.com and sign in with your Microsoft 365 account.

  2. Create a new flow

    Click Create in the left navigation, then select Automated cloud flow. Give your flow a name, such as "ALICE Visitor Check-In Notification".

  3. Add the HTTP trigger

    In the trigger search box, search for "When a HTTP request is received". Select this trigger from the results. This is a premium connector provided by Power Automate.

  4. Set the HTTP method

    In the trigger configuration, set the Method dropdown to POST. ALICE sends all webhook events as POST requests.

  5. Add the JSON schema

    Paste the ALICE payload schema into the Request Body JSON Schema field (covered in the next section). Then click Save.

  6. Copy the generated URL

    After saving, Power Automate generates an HTTP POST URL for the trigger. Copy this URL — you will use it as the targetUrl when creating your ALICE webhook subscription (see step 1 above).

Tip: If you are setting this up for the first time, complete steps 2 through 6 first to get the Power Automate URL, then go back to step 1 and create the ALICE webhook subscription using that URL as the targetUrl.

3. Configure the Trigger Schema

Providing a JSON schema tells Power Automate the shape of the ALICE webhook payload, making fields available as dynamic content in subsequent flow actions.

Paste the following schema into the Request Body JSON Schema field of the "When a HTTP request is received" trigger:

JSON Schema
{
  "type": "object",
  "properties": {
    "event": { "type": "string" },
    "version": { "type": "string" },
    "timestamp": { "type": "string" },
    "delivery_id": { "type": "string" },
    "test": { "type": "boolean" },
    "data": {
      "type": "object",
      "properties": {
        "id": { "type": "integer" },
        "first_name": { "type": "string" },
        "last_name": { "type": "string" },
        "email": { "type": "string" },
        "start_date": { "type": "string" },
        "end_date": { "type": "string" },
        "directory_id": { "type": "integer" },
        "employee_id": { "type": "integer" }
      }
    }
  }
}

Once the schema is saved, you can reference payload fields as dynamic content in your flow. For example:

Dynamic Content Field Source Example Value
eventTop-level event typeappointment.checked_in
data.first_nameVisitor first nameJane
data.last_nameVisitor last nameSmith
data.emailVisitor email addressjane.smith@example.com
data.start_dateAppointment start time2026-03-12T09:00:00Z
data.employee_idHost employee ID100
testWhether this is a test deliveryfalse

After configuring the schema and saving the flow, copy the generated HTTP POST URL from the trigger. Use this URL as the targetUrl when creating your ALICE webhook subscription.

Note: The Power Automate HTTP POST URL is unique to your flow and includes a SAS token for authentication. Do not share this URL publicly.

4. Test End-to-End

Use the ALICE webhook test endpoint to send a test event to your Power Automate flow and verify everything is connected correctly.

Send a test event

Send a POST request to the test endpoint using your subscription ID:

curl
curl -X POST https://your-api-url/api/webhooks/1/test \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."

What the test payload looks like

ALICE sends a test event with "test": true so your flow can distinguish test deliveries from real ones:

Test Payload
{
  "event": "appointment.checked_in",
  "version": "1.0",
  "timestamp": "2026-03-12T14:30:00Z",
  "delivery_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "test": true,
  "data": {
    "id": 42,
    "first_name": "Jane",
    "last_name": "Smith",
    "email": "jane.smith@example.com",
    "start_date": "2026-03-12T09:00:00Z",
    "end_date": "2026-03-12T10:00:00Z",
    "directory_id": 10,
    "employee_id": 100
  }
}

Verify in Power Automate

After sending the test event:

  1. Open your flow in Power Automate
  2. Navigate to the Run history tab (or click 28-day run history in the flow overview)
  3. You should see a new run with a Succeeded status
  4. Click the run to inspect the trigger inputs — confirm the payload fields match the test data above
Tip: You can use the test field in a Power Automate condition to skip actions during test deliveries. Add a Condition action that checks if test is equal to false before running your main workflow logic.

5. Troubleshooting

Common issues and how to resolve them.

Flow not triggering

If your Power Automate flow is not running when ALICE sends a webhook event:

  • Confirm the flow is turned on in Power Automate (check the toggle in the flow details page)
  • Verify the webhook subscription is active by calling GET /api/webhooks and checking that isActive is true
  • Confirm the targetUrl in your ALICE subscription exactly matches the HTTP POST URL shown in the Power Automate trigger
  • Check that the Power Automate flow has not been moved or re-saved, which can change the trigger URL

Authentication errors

The Power Automate "When a HTTP request is received" trigger includes a SAS token in the URL for authentication. No additional authentication configuration is needed. However:

  • If you see 401 or 403 errors in the ALICE delivery history, the Power Automate URL may have expired or been regenerated
  • The Who Can Trigger setting (under flow Settings) should be set to "Anyone" so ALICE can call the endpoint without Microsoft authentication
  • Re-copy the HTTP POST URL from the trigger and update your ALICE webhook subscription with the new targetUrl

Signature verification

Every ALICE webhook delivery includes an X-Alice-Signature header for verifying payload authenticity. The signature is an HMAC-SHA256 hash of the raw request body using your subscription secret.

To verify the signature in a Power Automate flow, you can use an Azure Function or inline code action (JavaScript):

Verification Logic (pseudocode)
// 1. Get the signature from the request header
signature = headers["X-Alice-Signature"]
// e.g., "sha256=a1b2c3d4e5f6..."

// 2. Compute HMAC-SHA256 of the raw request body
expected = "sha256=" + HMAC_SHA256(secret, rawBody).toHex()

// 3. Compare using constant-time comparison
isValid = secureCompare(signature, expected)

Additional delivery headers you can inspect:

Header Description Example
X-Alice-SignatureHMAC-SHA256 signature of the request bodysha256=a1b2c3d4e5f6...
X-Alice-EventThe event type that triggered this deliveryappointment.checked_in
X-Alice-Delivery-IdUnique identifier for this deliverya1b2c3d4-e5f6-7890-abcd-ef1234567890

Delivery failures

If ALICE is unable to deliver a webhook event to your Power Automate endpoint, you can inspect the delivery log:

curl
curl https://your-api-url/api/webhooks/1/deliveries \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."

The delivery log shows the HTTP status code returned by your endpoint, the response body, and the timestamp. Common failure scenarios:

Status Code Cause Resolution
404Power Automate flow deleted or URL changedRe-create the flow or update the subscription targetUrl
401 / 403SAS token expired or access restrictedRe-copy the trigger URL and update the subscription
429Power Automate throttlingCheck your Power Automate plan limits; consider adding delay between events
500Error in Power Automate flow actionsCheck the flow run history for error details
TimeoutFlow took too long to respondEnsure the trigger responds within 30 seconds; move long-running actions to async patterns