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

# Automate Tasks with Workflows

> Connect triggers to actions for hands-off automation across your Hiveku account

Workflows let you chain a trigger (something happens) to one or more actions (things Hiveku does in response). Use them to send Slack notifications when a form is submitted, email a daily report every morning, welcome new signups, or sync data between systems.

## Create Your First Workflow

<Steps>
  <Step title="Open Workflows">
    Click **Workflows** in the top navigation. Workflows are account-scoped, so they're shared across every project.
  </Step>

  <Step title="New Workflow">
    Click **New Workflow**, give it a descriptive name (e.g., *Slack on form submit*), and open the visual editor.
  </Step>

  <Step title="Add a trigger">
    Every workflow starts with one trigger node. Pick from:

    * **Webhook** — fires when an HTTP POST hits a unique URL
    * **Schedule** — cron-style timing (e.g., every day at 9 AM)
    * **Database change** — row inserted, updated, or deleted
    * **New visitor** — someone lands on a page
    * **Form submission** — a specific form is filled out
  </Step>

  <Step title="Add action nodes">
    Drag action nodes onto the canvas and connect them with edges:

    * **Send email** — transactional or custom HTML
    * **HTTP request** — POST/GET to any URL
    * **Database query** — read or write any table
    * **AI generation** — ask Claude to summarize, classify, draft
    * **Delay** — wait N seconds/minutes/hours/days
    * **Notification** — Slack, Discord, in-app
  </Step>

  <Step title="Add conditions (optional)">
    Drop in **if/else** nodes to branch based on data. For example: *if lead score > 50, notify sales; else, add to nurture list*.
  </Step>

  <Step title="Save and enable">
    Click **Save**, then flip the **Enabled** toggle. The workflow is live.
  </Step>
</Steps>

## Example Recipes

<CardGroup cols={2}>
  <Card title="Form submission to Slack">
    Webhook trigger -> Send notification to Slack channel -> Add to CRM contacts
  </Card>

  <Card title="Daily report">
    Schedule (9 AM daily) -> Database query -> AI generation (summary) -> Send email
  </Card>

  <Card title="Welcome sequence">
    Database change (users table insert) -> Delay 5 min -> Send email -> Delay 2 days -> Send email
  </Card>

  <Card title="Order confirmation">
    Database change (orders table) -> Send email -> HTTP request to shipping API
  </Card>
</CardGroup>

## Run History

Click any workflow to see its run history:

* **Completed** — finished without errors
* **Failed** — one of the steps errored
* **Running** — currently in flight (useful for long delays)
* **Pending** — queued but not yet started

Click any run to drill in: input data, step-by-step state at each node, and the exact error message if it failed.

## Dead Letter Queue

When a run fails, it lands in the **Dead Letter Queue** for that workflow. From there you can:

* **Replay** — re-run with the original input after fixing the root cause
* **Dismiss** — mark as handled without re-running

<Warning>
  Don't replay blindly. If the action charged a customer or sent an email, replaying may double-bill or double-send. Confirm the failure point was before any side effect.
</Warning>

## Versions

Every time you save a workflow, Hiveku snapshots a version. Open **Versions** in the top right of the editor to see the history, diff two versions, or roll back instantly. Great for recovering from a bad edit.

## Credentials

Shared credentials (Slack webhook URLs, API tokens, database passwords) live in **Workflows > Credentials**. They're stored encrypted and referenced by name — so you update a key in one place and every workflow using it picks up the new value.

## Verifying It Works

In the editor, click **Test Run** and provide sample input. Watch each node light up as it executes and inspect the output. Once Test Run passes, enable the workflow and trigger it for real.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Trigger didn't fire">
    * **Webhook** — confirm you're POSTing to the exact URL shown (regenerate it if unsure), and that the workflow is enabled
    * **Schedule** — confirm the cron expression is valid and that the timezone matches what you expect
    * **Database change** — confirm the trigger is on the right table and operation (insert vs update)
  </Accordion>

  <Accordion title="An action step failed">
    Most action failures are credential issues: expired tokens, revoked access. Open the run, click the failed step, and read the error. Update the credential in **Workflows > Credentials** and replay.
  </Accordion>

  <Accordion title="Stuck in the dead letter queue">
    Fix the underlying cause first (credential, bad data, downstream API outage) and *then* replay. Replaying without a fix just produces the same failure.
  </Accordion>

  <Accordion title="Loop is firing too often">
    Check the trigger — a **Database change** trigger on a table you update inside the same workflow can loop. Add a condition that skips updates originating from the workflow itself, or use a `last_updated_by` column.
  </Accordion>
</AccordionGroup>

## What's Next?

<CardGroup cols={2}>
  <Card title="Workflows Reference" icon="book" href="/integrations/workflows">
    Full node catalog, trigger types, and advanced patterns
  </Card>

  <Card title="Send Emails" icon="envelope" href="/how-tos/send-emails">
    Pair workflows with transactional email for automated outreach
  </Card>
</CardGroup>
