Test your connection

dc="us5"
apikey="713d0da93c6ea63434027dd1748a5803-us5"

curl -sS \
  "https://${dc}.api.mailchimp.com/3.0/ping" \
  --user "anystring:${apikey}" | jq -r

Get all members

curl -sS --request GET \
  --url "https://us5.api.mailchimp.com/3.0/lists/1be2cdbca9/members" \
  --user "key:713d0da93c6ea63434027dd1748a5803-us5" 

Add a member

#!/bin/bash set -euo pipefail

dc="us5" apikey="713d0da93c6ea63434027dd1748a5803-us5" list_id="1be2cdbca9" user_email="jerryseinfield@fifco.com" user_fname="Jerry" user_lname="Seinfield"

curl -sS --request POST
--url "https://${dc}.api.mailchimp.com/3.0/lists/${list_id}/members"
--user "key:${apikey}"
--header 'content-type: application/json'
--data @-
<<EOF { "email_address": "$user_email", "status": "unsubscribed", "FirstName": "$user_fname", "LastName": "$user_lname", "interests": { "af18b03926": false, "7f9b2139b1": false, "75890c027c": false, "848d6e0f5e": false, "a0bdbb9b33": false, "88196e6ffc": true, "bc0cfd667a": true, "e545201a2c": false, "3e6315518f": false, "6f15a114d4": false, "1bc8e5596f": false, "60e3f1252f": false, "bbdccf5002": false, "75893f0b23": false, "fa1e5822d4": true, "31216da512": false, "a0ea272f1e": true, "bdd0272a3b": false, "cc75ea8b73": false, "b4abc714a0": false, "6cb1907ccf": false }, "tags": ["2022-06-cyoa"], "merge_fields": { "FNAME": "$user_fname", "LNAME": "$user_lname" } } EOF

CVS Export Data Fields

"Email Address": ,
"First Name": ,
"Last Name": ,
"Address": ,
"Phone Number": ,
"No Emails!": ,
"Favorite Labatt Product": ,
"Occasion": ,
"Connection": ,
"Descriptor": ,
"MEMBER_RATING": ,
"OPTIN_TIME": ,
"OPTIN_IP": ,
"CONFIRM_TIME": ,
"CONFIRM_IP": ,
"LATITUDE": ,
"LONGITUDE": ,
"GMTOFF": ,
"DSTOFF": ,
"TIMEZONE": ,
"CC": ,
"REGION": ,
"LAST_CHANGED": ,
"LEID": ,
"EUID": ,
"NOTES": ,
"TAGS": 

INTEREST CATEGORIES

[
    { "mc_id": "5aab91de9c", 
    "mc_title": "Favorite Labatt Product",
    "options":[
        {
            "mc_id": "7f9b2139b1",
            "mc_name": "Labatt Blue"
        },
        {
            "mc_id": "75890c027c",
            "mc_name": "Labatt Blue Light"
        },
        {
            "mc_id": "848d6e0f5e",
            "mc_name": "Labatt Blue Light Flavors"
        },
        {
            "mc_id": "a0bdbb9b33",
            "mc_name": "Labatt Blue Light Seltzer"
        },
        {
            "mc_id": "88196e6ffc",
            "mc_name": "Labatt Blue Light Tart Seltzer"
        }
    ]  }, 

    {"mc_id": "aad9ccc3c9", 
    "mc_title": "Occasion",
    options: [
        {
            "mc_id": "bc0cfd667a",
            "mc_name": "Tailgating"
        },
        {
            "mc_id": "e545201a2c",
            "mc_name": "Camping at Lake"
        },
        {
            "mc_id": "3e6315518f",
            "mc_name": "Backyard Fire"
        },
        {
            "mc_id": "6f15a114d4",
            "mc_name": "Happy Hour"
        },
        {
            "mc_id": "1bc8e5596f",
            "mc_name": "Concert"
        }]},

    {"mc_id": "758b6212f8", 
    "mc_title": "Connection",
    "option": [   
    {
        "mc_id": "60e3f1252f",
        "mc_name": "Best Friends"
    },
    {
        "mc_id": "bbdccf5002",
        "mc_name": "Family"
    },
    {
        "mc_id": "75893f0b23",
        "mc_name": "Coworkers"
    },
    {
        "mc_id": "fa1e5822d4",
        "mc_name": "Kickball Team"
    },
    {
        "mc_id": "31216da512",
        "mc_name": "Significant Other"
    }]}

    {"mc_id": "cbbc1e0a97", 
    "mc_title": "Descriptor",
    "options":[{
        "mc_id": "a0ea272f1e",
        "mc_name": "Fun"
    },
    {
        "mc_id": "bdd0272a3b",
        "mc_name": "Kind"
    },
    {
        "mc_id": "cc75ea8b73",
        "mc_name": "Loyal"
    },
    {
        "mc_id": "b4abc714a0",
        "mc_name": "Competitive"
    },
    {
        "mc_id": "6cb1907ccf",
        "mc_name": "Romantic"
    }]}
]
```


## Example Request to send transactional email using a mandrill template
```
{
    "key": "Wnf7_H0QBGgpfzVSOm6V2w", 
    "template_name": "labatt-rebate-template",
    "template_content": [],
    "message": {
        "to": [
            {
                "name": "Denn Test",
                "email": "denise.nadal@fifco.com"
            }
        ],
        "merge": true,
        "merge_language": "mailchimp",
        "global_merge_vars": [
            {"name": "CURRENT_YEAR", "content": "2022"},
            {"name": "MC:SUBJECT", "content": "Here's your Labatt Rebate"},
            {"name": "MC_PREVIEW_TEXT", "content":  "This one's on us 🍻"}],
        "merge_vars": [{
            "rcpt": "denise.nadal@fifco.com",
            "vars": [ 
                {"name": "INTERESTED:Favorite Labatt Product", "content":  "Labatt Blue Light"},
            {"name": "FNAME", "content": "Denn"},
            {"name": "ARCHIVE", "content": "https://mailchi.mp/labattus/your-labatt-rebate-is-here?e=ffddef7d5f"},
            {"name": "UPDATE_PROFILE", "content": "https://labattusa.mailchimpsites.com/manage/preferences?u=43bad6c8bd2b2f6dc02f581b5&id=1be2cdbca9&e=ffddef7d5f&c=22c2ff7d40"},
            {"name": "UNSUB", "content": "https://fifcousa.us5.list-manage.com/unsubscribe?u=43bad6c8bd2b2f6dc02f581b5&id=1be2cdbca9"}]
        }],
        "tags": [],
        "subaccount": "labatt",
        "metadata": {
            "website": "labattus.com"
        }
    }
}
```

Archive URL
https://us5.campaign-archive.com/?u=43bad6c8bd2b2f6dc02f581b5&id=7eddb20243&e=3e2033037e
https://us5.campaign-archive.com/?e=3e2033037e&u=43bad6c8bd2b2f6dc02f581b5&id=7eddb20243


ACCOUNT ID | u = 43bad6c8bd2b2f6dc02f581b5
UNIQID | e = user's unique_email_id
id= campaign id

Flavor | Campaign ID | Campaign Web Id
Blue Light Seltzer Tart - 7eddb20243 | 202674
Blue - 5e691b2096 | 202682
Blue Light - 6b5a6fb31c | 202678
Blue Light Flavors - a9a7edae4c | 202642
Blue Light Seltzer - 620e686a67 | 202686




https://mailchi.mp/labattus/your-labatt-rebate-is-here-202686?e=ffddef7d5f