Let's build something great together

When you build integrations with ActiveCampaign, you can have a positive impact on small businesses across the world. This is where you can find ActiveCampaign API documentation, SDKs, support, and a community of developers like you.

Get Started    

Example Configuration

Below are three example configuration files. Depending on your use case - an inbound workflow, multiple outbound workflows or multiple outbound workflows with an inbound workflow can be used. Based on the workflows definition, parts of the configuration can be optional. Refer to the Configuration Walkthrough on how to modify this file to set up your integration.

Example Inbound Configuration

The following example is a PayPal inbound configuration.

{
  "$version": "2",
  "api": {
    "base_url": "https://api.paypal.com"
  },
  "auth": {
    "paypal-oauth": {
      "type": "oauth2",
      "configuration": {
        "authorization_base_url": "https://www.paypal.com/connect?flowEntry=static",
        "client_id": "[insert your client id here]",
        "client_secret": "[insert your secret here]",
        "scopes": [
          "profile", "email", "https://uri.paypal.com/services/paypalattributes"
        ],
        "token_request_body": "grant_type=authorization_code",
        "token_url": "https://api.paypal.com/v1/oauth2/token",
        "refresh_url": "https://api.paypal.com/v1/oauth2/token"
      }
    }
  },
  "data_intake": [
    {
      "name": "paypal_webhook",
      "type": "webhook",
      "scope": "application",
      "resource_id": {
        "!jq": ".event_type"
      },
      "account_id": {
        "!jq": ".resource.purchase_units[0].payee.email_address"
      },
      "create": {
        "!pipe": [
          {
            "!http": {
              "body": {
                "url": "${webhook::url}",
                "event_types": [
                  {
                    "name": "CHECKOUT.ORDER.APPROVED"
                  },
                  {
                    "name": "CHECKOUT.ORDER.COMPLETED"
                  }
                ]
              },
              "method": "POST",
              "path": "/v1/notifications/webhooks",
              "headers": {
                "content-type": "application/json"
              }
            }
          },
          {
            "!jq": "{webhook_id: .id}"
          },
          {
            "!save": {
              "scope": "application"
            }
          }
        ]
      },
      "delete": {
        "!http": {
          "method": "DELETE",
          "path": "/v1/notifications/webhooks/${data::application::webhook_id}",
          "headers": {
            "content-type": "application/json"
          }
        }
      }
    }
  ],
  "workflows": [
    {
      "name": "create-contacts-from-paypal",
      "label": "Create Contacts From PayPal Orders",
      "description": "Create/update a ActiveCampaign contact when a customer approves or completes an order using PayPal.",
      "type": "generic",
      "resource_type": "events",
      "data_intake": "paypal_webhook",
      "auth": "paypal-oauth",
      "setup": {
        "connect": {
          "label": "Connect",
          "describe_connection": {
            "!pipe": [
              {
                "!http": {
                  "method": "GET",
                  "path": "/v1/identity/oauth2/userinfo?schema=paypalv1.1",
                  "headers": {
                    "content-type": "application/json"
                  }
                }
              },
              {
                "!jq": "(.emails[] | select(.primary == true) | .value) as $email | {account_id: $email, description: (.name + \" - \" + $email)}"
              }
            ]
          }
        },
        "select": {
          "label": "Select PayPal Event",
          "description": "Select a PayPal Event.",
          "describe_selection": {
            "resource_id": {
              "!jq": "[${custom_data::resource.value}, ${custom_data::event.value}] | join(\".\")"
            },
            "display": {
              "!jq": "[${custom_data::resource.display}, ${custom_data::event.display}] | join(\" \")"
            }
          },
          "form_fields": [
            {
              "label": "Choose Resource",
              "type": "dropdown",
              "id": "resource",
              "placeholder": "Select Resource",
              "options": {
                "!jq": "[{display: \"Checkout Order\", value: \"CHECKOUT.ORDER\"}]"
              }
            },
            {
              "label": "Choose Event Type",
              "type": "dropdown",
              "id": "event",
              "placeholder": "Select Event",
              "options": {
                "!jq": "[{display: \"Approved\", value: \"APPROVED\"}, {display: \"Completed\", value: \"COMPLETED\"}]"
              }
            }
          ]
        },
        "map": {
          "label": "Mapping",
          "describe_source": {
            "label": "PayPal",
            "options": {
              "!jq": "[\"create_time\", \"summary\", \"given_name\", \"surname\", \"email_address\", \"payer_id\", \"national_number\", \"birth_date\", \"tax_id\", \"tax_id_type\", \"address_line_1\", \"address_line_2\", \"admin_area_2\", \"admin_area_1\", \"postal_code\", \"country_code\"] | map({id: ., title: . | split(\"_\") | join(\" \")})"
            }
          },
          "describe_target": {
            "label": "ActiveCampaign",
            "options": {
              "!resource": "ActiveCampaignContact.fields"
            }
          }
        }
      },
      "data_pipeline": {
        "source": {
          "!jq": "{create_time: .create_time, summary: .summary} + (.resource.payer | (.name | {given_name: .given_name, surname: .surname }) + {email_address: .email_address, payer_id: .payer_id} +  (.phone.phone_number | {national_number: .national_number}) + {birth_date: .birth_date}  +  (.tax_info | {tax_id: .tax_id, tax_id_type: .tax_id_type }) + (.address | {address_line_1: .address_line_1, address_line_2: .address_line_2, admin_area_2: .admin_area_2, admin_area_1: .admin_area_1, postal_code: .postal_code, country_code: .country_code }))"
        },
        "target": {
          "!resource": "ActiveCampaignContact"
        }
      }
    }
  ]
}

Example Outbound Configuration

The following example is a Slack outbound configuration.

{
  "$version": "2",
  "api": {
    "auth": "oauth2",
    "base_url": "https://slack.com/api",
    "pagination": {
      "style": {
        "type": "cursor",
        "cursor_query_param": "cursor",
        "limit": {
          "param": "limit",
          "value": 200
        },
        "ordering": {
          "param": "asc",
          "value": ""
        }
      },
      "parser": {
        "next_result_token": {
          "!jq": ".response_metadata.next_cursor"
        }
      }
    }
  },
  "auth": {
    "oauth2_configuration": {
      "authorization_base_url": "https://slack.com/oauth/v2/authorize",
      "client_id": "",
      "client_secret": "",
      "scopes": [
        "channels:read",
        "groups:read",
        "chat:write",
        "chat:write.public"
      ],
      "token_url": "https://slack.com/api/oauth.v2.access",
      "refresh_url": "https://slack.com/api/oauth.v2.access?grant_type=refresh_token"
    },
    "type": "oauth2"
  },
  "workflows": [
    {
      "label": "Post Message to a Slack Channel",
      "description": "Post a message automatically to a Slack channel of your choosing",
      "name": "post-a-message",
      "type": "automations",
      "setup": {
        "connect": {
          "label": "Connect",
          "describe_connection": {
            "!pipe": [
              {
                "!http": {
                  "method": "POST",
                  "path": "/auth.test"
                }
              },
              {
                "!jq": "{account_id: .user_id, description: (.team + \" Slack Workspace\")}"
              }
            ]
          }
        },
        "select": {
          "label": "Message Settings",
          "form_fields": [
            {
              "label": "Select Channel",
              "id": "channel_id",
              "type": "dropdown",
              "options": {
                "!pipe": [
                  {
                    "!http": {
                      "method": "GET",
                      "path": "/conversations.list",
                      "params": {"types": "public_channel,private_channel" },
                      "pagination": true
                    }
                  },
                  {
                    "!jq": "[.channels[] | {display: .name, value: .id}]"
                  }
                ]
              }
            },
            {
              "label": "Enter Message",
              "id": "message",
              "type": "textarea",
              "personalize": "ActiveCampaignContact"
            }
          ]
        }
      },
      "data_pipeline": {
        "source": {
            "!resource": "ActiveCampaignContact"
        },
        "target": {
          "!pipe": [
            {
              "!http": {
                "method": "POST",
                "path": "https://slack.com/api/chat.postMessage",
                "body": {
                  "channel": "${custom_data::channel_id.value}",
                  "text": "${custom_data::message.value}",
                  "username": "ActiveCampaign"
                },
                "headers": {
                  "Content-Type": "application/json"
                }
              }
            }
          ]
        }
      }
    }
  ]
}

Example Multiple Outbound with an Inbound Configuration

The following example is a Zendesk Sell configuration with multiple outbound and an inbound.

{
  "$version": "2",
  "api": {
    "base_url": "https://api.getbase.com",
    "rate_limit": {
      "app": {
        "requests": 10,
        "period": 1
      }
    },
    "pagination": {
      "style": {
        "type": "page",
        "page_number": {
          "param": "page",
          "value": 1
        },
        "page_size": {
          "param": "per_page",
          "value": 25
        }
      },
      "parser": {
        "next_page_url": {
          "!jq": ".meta.links.next_page"
        }
      }
    }
  },
  "auth": {
    "zendesk_oauth2": {
      "type": "oauth2",
      "configuration": {
        "authorization_base_url": "https://api.getbase.com/oauth2/authorize",
        "client_id": "",
        "client_secret": "",
        "scopes": [
          "read",
          "write",
          "profile"
        ],
        "token_url": "https://api.getbase.com/oauth2/token",
        "refresh_url": "https://api.getbase.com/oauth2/token"
      }
    }
  },
  "data_intake": [
        {
            "name": "zendesk_webhook",
            "type": "webhook",
            "scope": "workflow",
            "create": {
                "!http": {
                    "body": {
                        "enabled": true,
                        "url": "${webhook::url}"
                    },
                    "method": "PUT",
                    "path": "forms/${custom_data::form.value}/webhooks/${webhook::id}"
                }
            },
            "delete": {
                "!http": {
                    "method": "DELETE",
                    "path": "forms/${custom_data::form.value}/webhooks/${webhook::id}"
                }
            }
        }
    ],
  "workflows": [
    {
      "label": "Create and Update Leads in Zendesk Sell",
      "description": "Create and Update Leads in Zendesk Sell",
      "name": "create-lead-zendesk",
      "type": "automations",
      "auth": "zendesk_oauth2",
      "setup": {
        "connect": {
          "label": "Connect",
          "describe_connection": {
            "!pipe": [
              {
                "!http": {
                  "method": "GET",
                  "path": "/v2/users/self"
                }
              },
              {
                "!jq": "{account_id: .data.id, description: (if .data.team_name | length > 0  then .data.team_name + \" - \" + .data.email else .data.email end)}"
              }
            ]
          }
        },
        "select": {
          "label": "Select Tags",
          "description": "You can associate one or more tags from ZendeskSell to the Lead being created",
          "form_fields": [
            {
              "label": "Tags (optional)",
              "id": "leads-tags",
              "type": "multiselect",
              "required": false,
              "placeholder": "Select Tag(s)",
              "options": {
                "!pipe": [
                  {
                    "!http": {
                      "method": "GET",
                      "path": "/v2/tags?resource_type=lead",
                      "pagination": true
                    }
                  },
                  {
                    "!jq": "[.items[] | .data | {display: .name, value: .id}]"
                  }
                ]
              }
            }
          ]
        },
        "map": {
          "label": "Mapping",
          "describe_source": {
            "label": "ActiveCampaign",
            "options": {
              "!resource": "ActiveCampaignContact.fields"
            }
          },
          "describe_target": {
            "label": "Zendesk Sell",
            "options": {
              "!pipe": [
                {
                  "!jq": "[\"first_name\", \"last_name\", \"organization_name\",\"status\", \"source_id\", \"title\", \"description\", \"industry\", \"website\", \"email\", \"phone\", \"mobile\", \"fax\", \"twitter\", \"facebook\", \"linkedin\", \"skype\"]"
                },
                {
                  "!http": {
                    "method": "GET",
                    "path": "/v2/lead/custom_fields"
                  }
                },
                {
                  "!jq": "${piped_content::1} + [.items[].data.name]"
                },
                {
                  "!jq": "[\"last_name\", \"email\"] as $required | map(. as $input | {id: ., title: . | split(\"_\") | join(\" \"), required: (if ($required | index($input) == null) then false else true end) })"
                }
              ]
            }
          }
        }
      },
      "data_pipeline": {
        "source": {
          "!resource": "ActiveCampaignContact"
        },
        "target": {
          "!pipe": [
            {
              "!jq": "[\"first_name\", \"last_name\", \"organization_name\",\"status\", \"source_id\", \"title\", \"description\", \"industry\", \"website\", \"email\", \"phone\", \"mobile\", \"fax\", \"twitter\", \"facebook\", \"linkedin\", \"skype\", \"tags\"]"
            },
            {
              "!jq": "${custom_data::tags | default} as $tags | if ($tags | length) > 0 then {tags: ${custom_data::tags} | map(.display)} else null end"
            },
            {
              "!jq": "${piped_content::0} | ${piped_content::1} as $core_fields | with_entries(select((.key as $k | $core_fields | index($k)))) + (with_entries(select((.key as $k | $core_fields | index($k) | not))) | {custom_fields: .}) + ${piped_content::2}"
            },
            {
              "!jq": ".email"
            },
            {
              "!http": {
                "method": "POST",
                "path": "https://api.getbase.com/v2/leads/upsert?email=${piped_content::4}",
                "body": {
                  "data": "${piped_content::3}"
                },
                "headers": {
                  "Content-Type": "application/json"
                }
              }
            }
          ]
        }
      }
    },
    {
      "label": "Create and Update Contacts in Zendesk Sell",
      "description": "Create and Update Contacts in Zendesk Sell",
      "name": "create-contact-zendesk",
      "type": "automations",
      "auth": "zendesk_oauth2",
      "setup": {
        "connect": {
          "label": "Connect",
          "describe_connection": {
            "!pipe": [
              {
                "!http": {
                  "method": "GET",
                  "path": "/v2/users/self"
                }
              },
              {
                "!jq": "{account_id: .data.id, description: (if .data.team_name | length > 0  then .data.team_name + \" - \" + .data.email else .data.email end)}"
              }
            ]
          }
        },
        "select": {
          "label": "Select Tags",
          "description": "You can associate one or more tags from ZendeskSell to the Lead being created",
          "form_fields": [
            {
              "label": "Tags (optional)",
              "id": "contacts-tags",
              "type": "multiselect",
              "required": false,
              "placeholder": "Select Tag(s)",
              "options": {
                "!pipe": [
                  {
                    "!http": {
                      "method": "GET",
                      "path": "/v2/tags?resource_type=lead",
                      "pagination": true
                    }
                  },
                  {
                    "!jq": "[.items[] | .data | {display: .name, value: .id}]"
                  }
                ]
              }
            }
          ]
        },
        "map": {
          "label": "Mapping",
          "describe_source": {
            "label": "ActiveCampaign",
            "options": {
              "!resource": "ActiveCampaignContact.fields"
            }
          },
          "describe_target": {
            "label": "Zendesk Sell",
            "options": {
              "!pipe": [
                {
                  "!jq": "[\"first_name\", \"last_name\", \"name\",\"is_organization\", \"creator_id\",\"owner_id\",\"customer_status\", \"customer_status\", \"creator_id\", \"title\", \"description\", \"industry\", \"website\", \"email\", \"phone\", \"mobile\", \"fax\", \"twitter\", \"facebook\", \"linkedin\", \"skype\"]"
                },
                {
                  "!http": {
                    "method": "GET",
                    "path": "/v2/contact/custom_fields"
                  }
                },
                {
                  "!jq": "${piped_content::1} + [.items[].data.name]"
                },
                {
                  "!jq": "[\"last_name\", \"email\"] as $required | map(. as $input | {id: ., title: . | split(\"_\") | join(\" \"), required: (if ($required | index($input) == null) then false else true end) })"
                }
              ]
            }
          }
        }
      },
      "data_pipeline": {
        "source": {
          "!resource": "ActiveCampaignContact"
        },
        "target": {
          "!pipe": [
            {
              "!jq": "[\"first_name\", \"last_name\", \"name\",\"is_organization\", \"creator_id\",\"owner_id\",\"customer_status\", \"customer_status\", \"creator_id\", \"title\", \"description\", \"industry\", \"website\", \"email\", \"phone\", \"mobile\", \"fax\", \"twitter\", \"facebook\", \"linkedin\", \"skype\", \"tags\"]"
            },
            {
              "!jq": "${custom_data::tags | default} as $tags | if ($tags | length) > 0 then {tags: ${custom_data::tags} | map(.display)} else null end"
            },
            {
              "!jq": "${piped_content::0} | ${piped_content::1} as $core_fields | with_entries(select((.key as $k | $core_fields | index($k)))) + (with_entries(select((.key as $k | $core_fields | index($k) | not))) | {custom_fields: .}) + ${piped_content::2}"
            },
            {
              "!jq": ".email"
            },
            {
              "!http": {
                "method": "POST",
                "path": "https://api.getbase.com/v2/contacts/upsert?email=${piped_content::4}",
                "body": {
                  "data": "${piped_content::3}"
                },
                "headers": {
                  "Content-Type": "application/json"
                }
              }
            }
          ]
        }
      }
    },
    {
      "label": "Zendesk Sell",
      "description": "Create and Update Contacts in ActiveCampaign",
      "name": "zendesk-sell-forms",
      "type": "generic",
      "data_intake": "zendesk_webhook",
      "auth": "zendesk_oauth2",
      "resource_type": "form",
      "setup": {
        "connect": {
          "label": "Connect",
          "describe_connection": {
            "!pipe": [
              {
                "!http": {
                  "method": "GET",
                  "path": "/me"
                }
              },
              {
                "!jq": "{account_id: .email, description: [.alias, .email] | join(\" - \")}"
              }
            ]
          }
        },
        "select": {
          "label": "Select Form",
          "description": "Select a form from the list.",
          "describe_selection": {
            "resource_id": {
              "!jq": "${custom_data::form.value}"
            },
            "display": {
              "!jq": "${custom_data::form.display}"
            }
          },
          "form_fields": [
            {
              "label": "Choose Your Form",
              "type": "dropdown",
              "id": "form",
              "placeholder": "Select Form",
              "options": {
                "!pipe": [
                  {
                    "!http": {
                      "method": "GET",
                      "params": {
                        "page_size": 200
                      },
                      "path": "/forms",
                      "pagination": true
                    }
                  },
                  {
                    "!jq": "[.items[] | {display: .title, value: .id}]"
                  }
                ]
              }
            }
          ]
        },
        "map": {
          "label": "Mapping",
          "describe_source": {
            "label": "Zendesk Sell",
            "options": {
              "!pipe": [
                {
                  "!http": {
                    "method": "GET",
                    "path": "/forms/${custom_data::form.value}"
                  }
                },
                {
                  "!jq": "[.fields[]|{title, id, type}]"
                }
              ]
            }
          },
          "describe_target": {
            "label": "ActiveCampaign",
            "options": {
              "!resource": "ActiveCampaignContact.fields"
            }
          }
        }
      },
      "data_pipeline": {
        "source": {
          "!jq": "[.form_response | .answers[] | { key: .field.id, value: (.text // .email // .date // .boolean // .url // .number // .phone_number // .file_url // .payment.amount // .choices.labels // .choice.label // .choice.other ) }] | from_entries"
        },
        "target": {
          "!resource": "ActiveCampaignContact"
        }
      }
    }
  ]
}

Updated 4 months ago

Example Configuration


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.