createEvent

Adds or updates a contact in a Mailchimp audience and creates an event. Under the hood, this action calls the add or update a list member and create an event for a list member API endpoints.

Configuration

This function type accepts the following parameters:

KeyTypeDefaultDescription
apiKeystring@mailchimp-api-keyYour Mailchimp API key
audiencestring@mailchimp-audienceYour Mailchimp audience ID
statusIfNewobjectsubscribedThe subscriber's status (see here for available values)
mergeFieldsobject{}Static merge fields to set on the contact

Example

{
"functions": {
"trackEvent": {
"app": "mailchimp",
"type": "createEvent",
"audience": "5ca598e7e8",
"mergeFields": {
"PLAN": "pro"
}
}
}
}

Arguments

This function type accepts the following client-side arguments when called:

KeyTypeDefaultDescription
emailAddress *stringThe contact's email address
eventName *stringThe name of the event (lowercase, no spaces, 2 - 30 characters)
eventPropertiesobject{}A collection of event properties
isSyncingbooleanfalseIf true, skips running automations for this event
mergeFieldsobject{}Dynamic merge fields to set on the contact

Example

import { createClient, trackEvent } from '@statickit/functions';
let client = createClient({ site: '{your-site-id}' });
let { status } = await trackEvent(client, {
emailAddress: "[email protected]",
eventName: "purchased",
eventProperties: {
item: "t-shirt"
}
});

Response

Returns a status and the following properties when successful:

KeyTypeDescription
idstringThe MD5 hash of the lowercase version of the list member's email address.