# Create an automation

> Build an automation from a blank canvas, choose its trigger, add actions such as Send Email, and save it.
>
> Source: https://docs.bcl.my/create-automation/

Build an automation yourself when no template is close to what you need. You name it, choose the event that starts it, and add the actions BCL should run. In this example, Kopi Kampung emails its sales team every time the wholesale enquiry form is sent.

To start from a ready-made workflow instead, see [Start an automation from a template](/automation-templates/).

## Name the automation

Start with a name, so you can find the automation later.

1. In the sidebar, click **Automations**, then click **New Automation**.

   *(Screenshot: The New Automation button on the Automations page)*

2. Enter a **Name** that says what it does, then click **Create**.

   *(Screenshot: The Create New Automation dialog with the Name field filled in)*

BCL opens the **Edit Workflow** page with an empty canvas.

> **Note**
> A new automation is switched on as soon as you create it. It does nothing until it has a trigger and an action, but switch it off with **Deactivate** if you want to finish it later.

## Choose the trigger

The trigger decides when the automation runs.

1. On the canvas, click **Select an Event**.

   *(Screenshot: The empty workflow canvas with the Select an Event box highlighted)*

2. In **Select Trigger Event**, click the event that should start the automation, for example **New Lead Received**.

   *(Screenshot: The Select Trigger Event panel with New Lead Received highlighted)*

3. Click the trigger on the canvas, then click the gear button under it to open its settings. You can also double-click a node.
4. Choose which forms it applies to, for example your form under **Lead Form**. Leave it empty to run for all forms. Payment triggers ask for a **Payment Source Type** first, such as **Payment Form**, then a **Specific Form**.

   *(Screenshot: The New Lead Received Trigger Settings with the Kopi Kampung Wholesale Enquiry form selected under Lead Form)*

5. Click **Save Trigger**.

## Add an action

Actions are joined one after another, starting from the trigger.

1. Click the trigger on the canvas so it is selected, then click **Add Node**. The new node is joined to the one you selected.
2. In **Add Action**, click what BCL should do, for example **Send Email**.

   *(Screenshot: The Add Action panel with Send Email highlighted)*

3. The new node shows a red mark until it is set up. Click it, click the gear button and fill in the settings. For **Send Email**:

   | Field | What to enter |
   | --- | --- |
   | **Action Name** | A short name shown on the canvas. |
   | **Recipient Email** | An address, or `{email}` for the customer's email on payment triggers. |
   | **Email Subject** and **Email Content** | Your message. Click **Variables** to insert details such as a form answer. |

   *(Screenshot: The Email Action Settings with the recipient, subject and content filled in)*

4. To check the result, enter your own address under **Test Email** in the same panel and send a test.
5. Click **Save Email**.

Add more nodes the same way. Under a selected node, the buttons next to the gear copy or delete it.

## Save and switch it on

Node settings are saved one by one, but the workflow needs saving too.

1. Click **Update Automation**.

   *(Screenshot: The finished workflow with the Update Automation button highlighted)*

2. Check that it is on: the button at the top says **Deactivate** when the automation is on, and **Activate** when it is off. On the **Automations** list, the **Status** switch shows the same.

## Tips

Build carefully, because an automation runs by itself:

- **Test with your own details first.** Use the test option in the action, or make a test purchase in Test Mode, then check the [automation's history](/automation-history/).
- **Pick specific forms in the trigger.** An empty form list means every form, which is easy to forget when you add a new form later.
- **Use the variable picker.** A mistyped variable is sent as an empty value without any error, so pick variables from **Variables** instead of typing them.

## Common issues

### How do I send an email to my sales team every time a lead form is sent?

Create an automation with the New Lead Received trigger, choose your form under Lead Form, then add a Send Email action with your team's address as the Recipient Email.

### Why is there a red mark on a node in my workflow?

The node is not set up yet. Click it, click the gear button under it, fill in the required fields and save.

### How do I put the customer's name or a form answer into the message?

Click Variables next to the field and pick one from the list. Payment automations use names like {name} and {order_number}, and lead form fields look like {full_name:1}.
