Netzo Logo

activecampaign

ActiveCampaign is a customer experience automation (CXA) platform that helps businesses better engage customers.

Usage

import { activecampaign } from 'netzo/apis/activecampaign.ts'

const api = activecampaign({
  accountName: Deno.env.get('ACTIVECAMPAIGN_ACCOUNT_NAME'),
  apiKey: Deno.env.get('ACTIVECAMPAIGN_API_KEY'),
})

Configuration

The activecampaign factory function expects an object with the following, and returns an object with an API client api.

ParamTypeDefaultDescription
apiKeystringDeno.env.get('ACTIVECAMPAIGN_API_KEY')the api key to use for authentication
accountNamestringDeno.env.get('ACTIVECAMPAIGN_ACCOUNT_NAME')the name of the account
Refer to official API documentation for more information.

Examples

The following examples assume you have created an api client instance.

Find contacts

Find all contacts that match the query.

const query: QueryContacts = {}
const result = await api.contacts.get<Contacts>(query)
const resultData = result.contacts

Get contact

Get a contact by id.

const resultData = await api.contacts[CONTACT_ID].get<Contact>()

Add contact

Add a new contact.

const data: DataAddContact = {
  contact: {
    email: '[email protected]'
  }
}
const resultData = await api.contacts.post<AddOrUpdateContactResult>(data)

Update contact

Update a contact by id.

const data: DataUpdateContact = {
  contact: {
    email: '[email protected]'
  }
}
const resultData = await api.contacts[CONTACT_ID].put<AddOrUpdateContactResult>(data)

Delete contact

Delete a contact by id.

const resultData = await api.contacts[CONTACT_ID].delete<{}>()

Find deals

Find all deals with optional filtering.

const query: FilterDeals = {}
const result = await api.deals.get<Deals>(query)
const resultData = result.deals

Find accounts

Find all accounts, or specify a name in the search field.

const query: QueryAccounts = {}
const result = await api.accounts.get<Accounts>(query)
const resultData = result.accounts

Find users

Find all users of the account.

const result = await api.users.get<Users>()
const resultData = result.users

Add user

Add a new user to the account.

const data: DataAddUser = {
  user: {
    username: 'jsmith'
  }
}
const result = await api.users.post<AddUserResult>(data)
const resultData = result.user

References