mailchimp
Mailchimp is an all-in-one marketing platform.
Usage
import { mailchimpmarketing } from 'netzo/apis/mailchimpmarketing.ts'
const api = mailchimpmarketing({
marketingApiKey: Deno.env.get('MAILCHIMP_MARKETING_API_KEY'),
dataCenter: Deno.env.get('MAILCHIMP_DATA_CENTER'),
})
Configuration
The mailchimpmarketing
factory function expects an object with the following, and returns an object with an API client api
.
Param | Type | Default | Description |
---|---|---|---|
marketingApiKey | string | Deno.env.get('MAILCHIMP_MARKETING_API_KEY') | the api key to use for authentication |
dataCenter | string | Deno.env.get('MAILCHIMP_DATA_CENTER') | the data center for your account |
Refer to the API documentation to get the required information.
Examples
The following examples assume you have created an api client instance.
Find campaigns
Find all campaigns that match the query.
const query: QueryCampaigns = {}
const result = await api.campaigns.get<Campaigns>(query)
const resultData = result.campaigns
Get campaign
Get a campaign by id.
const query: QueryCampaign = {}
const resultData = await api.campaigns[CAMPAIGN_ID].get<Campaign>(query)
Get campaign content
Get the content of a campaign by id.
const query: QueryCampaign = {}
const resultData = await api.campaigns[CAMPAIGN_ID].content.get<CampaignContent>(query)
Update campaign content
Set the content of a campaign by id.
const data: DataUpdateCampaignContent = { url: '[email protected]' }
const resultData = await api.campaigns[CAMPAIGN_ID].content.put<CampaignContent>(data)
Schedule campaign
Schedule a campaign for delivery.
const data: DataScheduleCampaign = { schedule_time: '2024-05-30T15:00' }
const resultData = await api.campaigns[CAMPAIGN_ID].post<{}>(data)