Skip to main content

Example

What you'll build

Build a WSO2 Integrator automation that subscribes a new member to a Mailchimp mailing list. The integration authenticates via HTTP Basic Auth and calls the Mailchimp Marketing API to add a member to a specified audience list.

Operations used:

  • Add member to list : Subscribes a new member to a Mailchimp audience list by providing the list ID and member details

Architecture

Prerequisites

  • A Mailchimp account with API access
  • Your Mailchimp username and API key (used as the HTTP Basic Auth password)
  • A Mailchimp List ID (also called Audience ID) for the target mailing list

Setting up the Mailchimp marketing integration

New to WSO2 Integrator? Follow the Create a New Integration guide to set up your integration first, then return here to add the connector.

Adding the Mailchimp marketing connector

Step 1: Open the connector palette

In the left sidebar, hover over Connections to reveal the + button, then select + to open the connector palette.

Mailchimp Marketing connector palette open with search field before any selection

Step 2: Search for and select the connector

  1. In the Search field, enter mailchimp to filter the results.
  2. Select Marketing (the ballerinax/mailchimp.marketing connector) from the search results.

Configuring the Mailchimp marketing connection

Step 3: Fill in the connection parameters

In the Configure Marketing form, bind each connection parameter to a configurable variable:

  • Connection Name : Enter marketingClient
  • username : Bind to a new configurable variable named mailchimpUsername of type string
  • password : Bind to a new configurable variable named mailchimpPassword of type string

Mailchimp Marketing connection form fully filled with all parameters before saving

Step 4: Save the connection

Select Save to create the connection. The marketingClient connection node now appears on the design canvas and in the left sidebar under Connections.

Mailchimp Marketing Connections panel showing marketingClient entry after saving

Step 5: Set actual values for your configurables

  1. In the left panel, select Configurations.
  2. Set a value for each configurable listed below.
  • mailchimpUsername (string) : Your Mailchimp account username
  • mailchimpPassword (string) : Your Mailchimp API key, used as the HTTP Basic Auth password

Configuring the Mailchimp marketing add member to list operation

Step 6: Add an automation entry point

  1. Select + Add Artifact in the design canvas area.
  2. Under Automation, select Automation.
  3. In the Create New Automation dialog, accept the default settings and select Create.

The canvas switches to the Automation flow view, showing a Start node, an Error Handler node, and an End node.

Step 7: Select and configure the add member to list operation

  1. Select the + button between Start and Error Handler.
  2. In the Node Panel, select marketingClient to expand its list of available operations.

Mailchimp Marketing connection node expanded showing all available operations before selection

  1. Scroll to the Lists section and select Add member to list.
  2. Fill in the required fields:
  • ListId : The unique Mailchimp Audience/List ID to subscribe to
  • Payload : Member details including email address and subscription status
  • Result : Variable name to store the API response

Mailchimp Marketing add member to list operation configuration filled with all values

Select Save to add the operation to the automation flow.

Completed Mailchimp Marketing automation flow

Try it yourself

Try this sample in WSO2 Integration Platform.

Deploy to Devant

View source on GitHub

More code examples

The Mailchimp Marketing connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:

  1. Add Mailchimp Subscriber – Add a new subscriber to a specific Mailchimp audience list.
  2. List Mailchimp Audiences – Fetch and display a list of all your Mailchimp audience lists.