---
title: "Connect ActiveCampaign and SQL Server - APIANT.ai"
description: "When \"Contact unsubscribed from list\" fires in ActiveCampaign, your agent runs \"Update Row\" in SQL Server."
canonical: "https://apiant.ai/connect/activecampaign-to-sql-server"
---

# Connect ActiveCampaign and SQL Server

When **Contact unsubscribed from list** fires in [ActiveCampaign](https://apiant.ai/connections/activecampaign), your agent runs **Update Row** in [SQL Server](https://apiant.ai/connections/sql-server), or **New or Updated Row** in SQL Server to **Add contact to list** in ActiveCampaign. Describe the whole flow and it is built, tested on every scenario and kept running.

ActiveCampaign **19** triggers ActiveCampaign **84** actions SQL Server **4** triggers SQL Server **7** actions

What the catalog holds today. Ask for anything missing and your agent reads the API documentation and adds it.

## What do you want ActiveCampaign and SQL Server to do together?

Give your AI client this address.

`https://mcp.apiant.ai`

One connection does both: ask your client to act in an app once, or have it build an automation that keeps running. Any client that takes a remote MCP server. Nothing to install. Create your free account, then sign in once in your browser.

### Set it up in your client

### Claude Code

Run this in the directory you want to work in.

`claude mcp add --transport http -s project apiant-ai https://mcp.apiant.ai`

Start Claude Code there, approve the server, and sign in in the browser page it opens.

[Claude Code guide (opens in a new tab)](https://apiant.ai/docs/mcp/claude-code)

### Claude, web and desktop

Open Customize, then Connectors, then Add custom connector, and paste the address. On Team and Enterprise an owner adds it first.

[Setup guide (opens in a new tab)](https://apiant.ai/docs/mcp)

### Cursor

Add the address to your MCP configuration as a server URL. Cursor signs you in in your browser.

[Setup guide (opens in a new tab)](https://apiant.ai/docs/mcp)

### Zed

Open Settings, then AI, then MCP Servers, then Add Server, then Add Remote Server.

[Setup guide (opens in a new tab)](https://apiant.ai/docs/mcp)

### Codex and the ChatGPT desktop app

Open Settings, then MCP servers, then Add server, and choose Streamable HTTP. From the terminal, Codex takes the address with its own add command and then signs you in.

[Setup guide (opens in a new tab)](https://apiant.ai/docs/mcp)

### Any other MCP client

Paste the address where the client asks for a remote MCP server URL, and name the server apiant-ai where it lets you. APIANT's skills reach the client over the same connection.

[Setup guide (opens in a new tab)](https://apiant.ai/docs/mcp)

Connecting SQL Server and ActiveCampaign lets your database stay the source of truth for who your contacts are. New or changed rows in SQL Server can create or update contacts, set custom fields and add tags in ActiveCampaign, while tag changes, unsubscribes and other contact events in ActiveCampaign can be written straight back into your tables.

Example flows

## What ActiveCampaign and SQL Server can do together

### From ActiveCampaign to SQL Server

- When **Contact unsubscribed from list** in ActiveCampaign then **Update Row** in SQL Server
- When **Tag added to contact** in ActiveCampaign then **Add Row** in SQL Server

### From SQL Server to ActiveCampaign

- When **New or Updated Row** in SQL Server then **Add contact to list** in ActiveCampaign
- When **New Row** in SQL Server then **Add or update contact by email** in ActiveCampaign

Starting points drawn from the triggers and actions in the catalog today. Describe the flow you need, at any depth, and your agent builds it and tests every scenario before it ships.

Everything your agent can do with ActiveCampaign and SQL Server

## Triggers and actions 23 triggers · 91 actions

- Trigger

**Contact unsubscribed from list**

Fires instantly when a contact unsubscribes from a list. Self-registers an ActiveCampaign webhook for the 'unsubscribe' event.

- Trigger

**Deal task completed**

Fires instantly when a deal task is completed.

- Trigger

**Email opened**

Fires instantly when a contact opens an email. Self-registering ActiveCampaign webhook on the 'open' event.

- Trigger

**Link clicked in email**

Fires instantly when a contact clicks a link in an email. Self-registers an ActiveCampaign webhook for the click event.

- Trigger

**New contact**

Polling trigger. Fires when a new contact is created, newest first.

- Trigger

**New contact added to list**

Triggers when a new contact is added to a list.

- Trigger

**New deal**

Polling trigger. Fires when a new deal is created, newest first.

- Trigger

**New deal task**

Fires instantly when a new deal task is created.

- Trigger

**New list**

Polling trigger. Fires when a new list is created, newest first.

- Trigger

**New note**

Triggered when a new note is created.

- Trigger

**New or updated contact**

Polling trigger. Fires when a contact is created or updated, by most-recent update.

- Trigger

**New or updated deal**

Triggers on a new or updated deal.

- Trigger

**New or updated deal (instant)**

Triggers when a new deal is created or an existing deal is updated.

- Trigger

**New tag**

Polling trigger. Fires when a new tag is created, newest first.

- Trigger

**New task**

Triggered when a new task is created.

- Trigger

**Tag added to contact**

Triggers when a tag is added to a contact.

- Trigger

**Tag removed from contact**

Fires instantly when a tag is removed from a contact.

- Trigger

**Two-way sync new or updated contacts**

A trigger for two-way syncing new and updated contacts, with enhanced on-the-fly mapping. Can only be used with enhanced two-way sync actions that support on-the-fly mapping.

- Trigger

**Two-way sync new or updated deals**

A trigger for two-way syncing new and updated deals, with enhanced on-the-fly mapping. Can only be used with enhanced two-way sync actions that support on-the-fly mapping.

- Action

**Add account**

Adds a new account (organization).

- Action

**Add contact**

Adds a new contact.

- Action

**Add contact to automation**

Adds a contact to an automation by contact ID and automation ID.

- Action

**Add contact to list**

Subscribes a contact to a list (status 1) or unsubscribes (status 2) via contactLists.

- Action

**Add contact via mapped list**

Adds (upserts) a contact with mapped fields and the target list id. Ports the dev v1 subscriber_add op to the AC v3 contact/sync endpoint.

- Action

**Add custom contact object record**

Adds a record for the specified contact custom object to the specified contact.

- Action

**Add deal**

Adds a new deal.

- Action

**Add deal via mappings**

Adds a new deal, accepting pipeline and stage by name (mapped) plus standard deal fields.

- Action

**Add list**

Creates a new list.

- Action

**Add note to contact**

Adds a note to a contact.

- Action

**Add or update contact by email**

Adds a new contact, or updates the existing contact if the email already exists (sync endpoint).

- Action

**Add tag**

Creates a new tag.

- Action

**Add tag to contact**

Adds an existing tag to a contact by tag ID and contact ID.

- Action

**Add task**

Adds a new task in ActiveCampaign

- Action

**Bulk import contacts**

Import many contacts in one call with tags/list membership.

- Action

**Clear contact custom field value**

Clears (empties) the value of the specified custom field for the specified contact.

- Action

**Create abandoned cart**

Creates an abandoned cart record via the Deep Data e-commerce integration (ecomOrders with abandonedDate).

- Action

**Create account association**

Creates an account association with a contact ID.

- Action

**Create a deal note**

Add a note to a deal.

- Action

**Create a deal stage**

Creates a new deal stage in the specified pipeline.

- Action

**Create a deal stage by mapped pipeline**

Creates a new deal stage in the mapped pipeline.

- Action

**Create an ecommerce customer**

Create a Deep Data ecommerce customer linking a contact to a store.

- Action

**Create an ecommerce order**

Create a Deep Data ecommerce order record.

- Action

**Create a note**

Create a free-text note attached to a CRM object.

- Action

**Create an SMS broadcast**

Create a new SMS broadcast message to a recipient list.

- Action

**Create a pipeline**

Creates a new pipeline (deal group) in ActiveCampaign.

- Action

**Create a secondary contact**

Associate an additional contact with a deal.

- Action

**Create or update custom-object record**

Upsert a custom-object (schema) record.

- Action

**Delete contact**

Deletes a contact by ID.

- Action

**Delete custom contact object record**

Deletes a record from the specified custom contact object.

- Action

**Delete deal**

Deletes an existing deal.

- Action

**Delete deal stage**

Deletes an existing deal stage.

- Action

**Delete list**

Deletes a list by ID.

- Action

**Delete note**

Delete a note by ID.

- Action

**Delete tag**

Deletes a tag by ID.

- Action

**Delete task**

Deletes a task by ID in ActiveCampaign

- Action

**Duplicate campaign**

Duplicates an ActiveCampaign campaign by ID

- Action

**Edit campaign**

Edits an existing campaign in ActiveCampaign

- Action

**Find account by name**

Finds an existing account by name. Returns matching accounts.

- Action

**Find contact by custom field**

Finds an existing contact by the value of a custom field. Provide the custom field's numeric ID and the value to search for.

- Action

**Find contacts by custom field**

Finds contacts by the selected custom field. May return zero, one, or multiple contact IDs. Use the "Get contact" action to fetch a contact's details.

- Action

**Find deal by title**

Finds an existing deal by title. An error occurs if a single exact match is not found.

- Action

**Find user by email**

Finds an existing user by email. An error occurs if a matching user is not found.

- Action

**Get account**

Returns account info for the specified account ID.

- Action

**Get all deal stages from specified pipeline**

Get all deal stages belonging to a pipeline, looked up by pipeline name. Returns each stage's title (Stage name) and id (Stage ID).

- Action

**Get automation**

Fetches an automation by ID. An error occurs if the automation is not found.

- Action

**Get campaign**

Retrieves a single campaign from ActiveCampaign by its ID.

- Action

**Get contact**

Get contact by ID. An error occurs if the contact is not found.

- Action

**Get contact by email**

Returns full contact details for the specified email address. An error occurs if the contact is not found.

- Action

**Get contact's deals**

Returns all deals associated with the specified contact.

- Action

**Get contact's lists**

Returns all lists the specified contact belongs to.

- Action

**Get contact's tags**

Returns all tags associated with the specified contact.

- Action

**Get deal**

Returns deal info for the specified deal ID.

- Action

**Get form**

Retrieve a single ActiveCampaign form by its ID.

- Action

**Get list**

Returns a single contact list by its id, including its name, sender information and subscriber counts.

- Action

**Get note**

Retrieve a single note by its ID.

- Action

**Get score**

Retrieve a single lead/contact scoring rule by its ID.

- Action

**Get segment**

Retrieve a single ActiveCampaign segment by ID.

- Action

**Get tag**

Fetches a tag by ID. An error occurs if the tag is not found.

- Action

**Get task**

Retrieves a task by ID from ActiveCampaign

- Action

**List all campaigns**

List email campaigns.

- Action

**List all pipelines**

List deal pipelines.

- Action

**List all scores**

List the account's lead/contact scoring rules.

- Action

**List all stages**

List deal pipeline stages.

- Action

**List all tasks**

List CRM tasks.

- Action

**List automations**

Returns a paginated list of all automations.

- Action

**List contacts**

Returns a paginated list of all contacts.

- Action

**List custom contact object records**

Returns a paginated list of all records for the specified custom contact object.

- Action

**List deals**

Returns a paginated list of all deals.

- Action

**List lists**

Returns a paginated list of all contact lists.

- Action

**List tags**

Returns a paginated list of all tags.

- Action

**Move deal to another stage**

Move a deal to a different pipeline stage.

- Action

**Remove contact from automation**

Removes a contact from an automation by deleting the contact automation record.

- Action

**Remove contact from list**

Removes a contact from the specified list.

- Action

**Remove tag from contact**

Removes a tag from a contact by the contactTag association ID.

- Action

**Remove tags from contact**

Removes the provided tags (by name, comma-separated) from a contact identified by email or contact ID.

- Action

**Set automation status**

Enables or disables an automation. Set status to '1' to enable or '0' to disable.

- Action

**Set custom field value for contact**

Create or update a contact's custom field value.

- Action

**Set deal currency custom field value**

Set the value for a deal's custom field of the "currency" type

- Action

**Update account**

Updates the specified account.

- Action

**Update contact**

Updates an existing contact having the specified ID.

- Action

**Update deal**

Updates an existing deal.

- Action

**Update tag**

Updates an existing tag.

- Action

**Update task**

Updates a task by ID in ActiveCampaign

- Trigger

**New or Updated Row**

Triggers when a new row is added or modified.

- Trigger

**New or Updated Row (Custom Query)**

Fires for each new or changed row returned by a SELECT statement you write against the connected SQL Server database.

- Trigger

**New Row**

Triggers when you add a new row.

- Trigger

**New Table**

Fires when a new table appears in the connected SQL Server database.

- Action

**Add Row**

Add one row to a table on the connected SQL Server database.

- Action

**Delete Row**

Delete the rows in a table whose chosen column equals a value.

- Action

**Find Row**

Find the first row in a table whose chosen column matches a value.

- Action

**Find Rows via Custom Query**

Runs a SELECT statement you write against the connected SQL Server database and returns every row it matches.

- Action

**Find Row via Custom Query**

Runs a SELECT statement you write against the connected SQL Server database and returns the first row it matches.

- Action

**Run Custom Statement**

Runs a statement you write against the connected SQL Server database that changes data rather than returning rows, and reports how many rows it changed.

- Action

**Update Row**

Change column values on every row of a table whose chosen column matches a value.

## Each app on its own

- [ **ActiveCampaign** ActiveCampaign is a marketing automation, email marketing, and CRM platform.](https://apiant.ai/connections/activecampaign)
- [ **SQL Server** Connect directly to a Microsoft SQL Server database and run SQL statements from your automations.](https://apiant.ai/connections/sql-server)

Reviews

## What our customers say

## More from ActiveCampaign

- [ **ActiveCampaign to HubSpot** HubSpot is your all-in-one stop for all of your marketing software needs.](https://apiant.ai/connect/activecampaign-to-hubspot)
- [ **ActiveCampaign to Salesforce** Salesforce is a leading enterprise customer relationship management (CRM) platform.](https://apiant.ai/connect/activecampaign-to-salesforce)
- [ **ActiveCampaign to Google Sheets** Google Sheets](https://apiant.ai/connect/activecampaign-to-google-sheets)
- [ **ActiveCampaign to Gmail** Gmail is Google’s email service, featuring spam protection, search functions, and seamless integration with...](https://apiant.ai/connect/activecampaign-to-gmail)
- [ **ActiveCampaign to Google Drive** Google Drive is a cloud storage solution for uploading, sharing, and collaborating on files across devices...](https://apiant.ai/connect/activecampaign-to-google-drive)
- [ **ActiveCampaign to Stripe** Stripe is a payment processing platform for online businesses.](https://apiant.ai/connect/activecampaign-to-stripe)

## More into SQL Server

- [ **HubSpot to SQL Server** HubSpot is your all-in-one stop for all of your marketing software needs.](https://apiant.ai/connect/hubspot-to-sql-server)
- [ **Slack to SQL Server** Slack is a messaging platform for teams. Post messages, manage channels, users, reminders, and react to...](https://apiant.ai/connect/slack-to-sql-server)
- [ **Mailchimp to SQL Server** Mailchimp marketing automation and email platform.](https://apiant.ai/connect/mailchimp-to-sql-server)
- [ **Shopify to SQL Server** Shopify is a commerce platform for online stores and retail point-of-sale.](https://apiant.ai/connect/shopify-to-sql-server)
- [ **QuickBooks Online to SQL Server** QuickBooks Online accounting — manage customers, invoices, bills, payments, vendors, expenses, and more via...](https://apiant.ai/connect/quickbooks-online-to-sql-server)
- [ **Pipedrive to SQL Server** Pipedrive is a sales CRM and pipeline management tool.](https://apiant.ai/connect/pipedrive-to-sql-server)

Questions

## ActiveCampaign and SQL Server, answered

###

### Can I use my own SELECT statement instead of watching a whole table?

Yes, the New or Updated Row (Custom Query) trigger fires for each new or changed row returned by a SELECT you write, so you can filter to just the records you care about. The agent tests every scenario your query can produce before it goes live.

###

### How do I keep the ActiveCampaign contact id in my database?

After an action like Add or update contact by email returns the contact, you can use Update Row or Run Custom Statement in SQL Server to store the id on the matching row. From then on your lookups can match on that column instead of the email address.

###

### What can start an automation from ActiveCampaign?

Any of ActiveCampaign's 19 triggers in the catalog, including Contact unsubscribed from list, Tag added to contact, Deal task completed and New contact. Describe the moment in plain language and your agent picks the right one.

###

### What can your agent do in SQL Server when something happens in ActiveCampaign?

Any of SQL Server's 7 actions, including Run Custom Statement, Update Row, Add Row and Find Row. Your agent maps the data both ways and tests every scenario before it ships.

###

### Can it also run from SQL Server to ActiveCampaign?

Yes. When something happens in SQL Server, your agent can act in ActiveCampaign too. This page covers both directions: SQL Server's triggers and ActiveCampaign's actions are listed here as well.

###

### Do I have to build a connector for ActiveCampaign or SQL Server?

No. Both are in the catalog with their triggers and actions. You describe the automation; your agent builds it, tests every scenario and keeps it running.

###

### Can my AI client use ActiveCampaign and SQL Server without building an automation?

Yes. With your AI client connected to APIANT, ask it to do something in either app once and it runs that action on the spot. Ask for an automation and your agent builds it, tests every scenario and keeps it running. One connection covers both.

###

### What happens when something fails?

Your agent works that out for you. It plans the failure paths along with the happy path, then tests every scenario before it ships.

###

### Is there a free plan?

Yes. Every plan includes the agent, including free, and building from your own AI client spends no assistant credits.
