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

# Automate your MainWP workflow with SureTriggers

> Connect MainWP to SureTriggers to automate workflows like adding sites from form submissions, syncing data to spreadsheets, and managing sites automatically.

[Automate your MainWP workflow with SureTriggers - Video Tutorial](https://www.youtube.com/embed/aztVpEgSltk)

SureTriggers is an automation platform that connects plugins and apps together. With over 200 integrations including MainWP, you can automate tasks like adding child sites from form submissions or syncing site data to external services.

## What You'll Learn

* How to connect MainWP Dashboard to SureTriggers
* How to create automation workflows
* Available MainWP triggers and actions

## Prerequisites

* MainWP Dashboard with REST API access
* SureTriggers account
* WordPress site for form collection (if using form-based automation)

***

## Use Case Example

This guide demonstrates adding a child site automatically when a client submits a form. The form collects site URL, admin username, and site title, then triggers MainWP to add the site.

***

## Connect MainWP to SureTriggers

### Generate MainWP API Key

**1. Open API settings**

On your MainWP Dashboard, go to **Dashboard > API Access > API Keys > Add API Keys**.

**2. Create API key**

Generate a new API key with all permissions enabled.

**3. Save credentials**

Click **Show Legacy API Credentials**, then copy and save the Consumer Key and Consumer Secret. You'll need these for SureTriggers.

### Set Up SureTriggers Connection

**1. Install SureTriggers plugin**

On your WordPress site (where forms are collected), install and activate the SureTriggers plugin.

**2. Authorize account**

Click **Get Started Now** and authorize your SureTriggers account.

**3. Add MainWP connection**

Go to **Apps > Add New Connections**, search for MainWP, and click the icon.

**4. Enter credentials**

Enter your MainWP Dashboard URL, Consumer Key, and Consumer Secret. Click **Connect MainWP**.

***

## Create the Contact Form

Use any SureTriggers-compatible form plugin (WS Form, Gravity Forms, WPForms, etc.).

**1. Install form plugin**

Install and activate your chosen form plugin.

**2. Create form fields**

Add these required fields:

* **Site URL** (required)
* **Admin username** (required)
* **Site title**

**3. Add submit button**

Add a Submit button and publish the form.

**4. Place the form**

Embed the form on a protected page (like WooCommerce My Account) to prevent public access.

***

## Create the Workflow

**1. Start a new workflow**

In SureTriggers, go to **Workflows** and click **Create New**. Name the workflow and click **Start Building**.

**2. Add trigger**

Click **Add Trigger**, select your form plugin, and choose the **Form Submitted** event.

**3. Configure trigger**

Select the WordPress site connection and the specific form you created.

**4. Test trigger**

Submit a test form entry. SureTriggers fetches the sample data to understand the form fields. Click **Save**.

**5. Add action**

Click the plus icon, search for MainWP, and select **Add New Site** as the event.

**6. Map form fields**

Connect each form field to the corresponding MainWP field:

* Site URL → Site URL
* Admin username → Administrator username
* Site title → Site name

Type `@` to see available data points from the form submission.

**7. Publish workflow**

Click **Save**, then **Publish** to activate the workflow.

***

## Test the Integration

**1. Prepare a test site**

Set up a WordPress site with MainWP Child plugin installed and activated.

**2. Submit the form**

Fill out and submit the add-site form with the test site's information.

**3. Verify in MainWP**

Refresh your MainWP Dashboard's Manage Sites page. The child site should appear.

***

## Available Triggers and Actions

| Type | Event |
| - | - |
| Trigger | New Site Connected |
| Action | Add New Site |
| Action | Disconnect Site |
| Action | Remove Site |
| Action | Suspend Site |
| Action | Unsuspend Site |

***

## Automation Ideas

| Workflow | Trigger | Action |
| - | - | - |
| Add client sites | Form submission | Add New Site |
| Track new sites | New Site Connected | Add row to Google Sheet |
| Suspend for non-payment | Payment failed webhook | Suspend Site |
| Notify on new site | New Site Connected | Send Slack/email notification |

***

## Self-Check Checklist

* [ ] MainWP REST API key generated with full permissions
* [ ] SureTriggers plugin installed and authorized
* [ ] MainWP Dashboard connected to SureTriggers
* [ ] Contact form created with required fields
* [ ] Workflow trigger configured and tested
* [ ] Action mapped to correct form fields
* [ ] Workflow published and tested end-to-end

***

## Related Resources

* [REST API Overview](https://docs.mainwp.com/api-reference/rest-api/overview.md) - API documentation
* [WP-CLI Commands](https://docs.mainwp.com/advanced/miscellaneous/mainwp-wp-cli-commands.md) - Command-line automation


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