This article explains how to configure an UPSERT operation for the Mailchimp ListMembers object in Skyvia. This is the recommended approach for importing and updating Audience members without creating duplicates.
The UPSERT behavior depends on whether the Id field is mapped:
| Id value | Operation |
|---|---|
| Id is specified | Update - Skyvia attempts to update the existing member, even if the Id turns out to be incorrect |
| Id is NULL | Insert - Skyvia creates a new member; the Id is generated by Mailchimp |
When setting up UPSERT for the ListMembers object, the following fields must be mapped:
Configure a Lookup Mapping to resolve the member's Id based on their email and audience:
| Setting | Value |
|---|---|
| Lookup Object | ListMembers |
| Resulted Column | Id |
| Lookup Key Column 1 | ListId |
| Column 1 | ListId (or set as a Constant value) |
| Lookup Key Column 2 | |
| Column 2 |
Open Options in the Lookup Mapping and enable Set Null When No Match Found.
Note: This option is required only for UPSERT. When no existing member is found, the Id becomes NULL and triggers an Insert operation.
Map ListId to a Constant (enter the target Audience ID as a constant value) and map Email from the source column.
Map any additional fields required for your use case (e.g., first name, last name, subscription status).
Use one of the following methods:
SELECT "Id", "Name" FROM "Lists"