hello everyone, I have a bot and I want to collect...
# đź’»developers
hello everyone, I have a bot and I want to collect user information and send it to a mailchimp list to send an email using the data collected. This is the snippet provided by mailchimp to test the connection its in nodejs
Copy code
import client from "@mailchimp/mailchimp_marketing";

  server: "",

async function run() {
  const response = await mailchimp.ping.get();

Is there anyway I can make this connection using an api call because using zapier is not cost effective at all. Will welcome any reccomendations thank you
const apiKey = "XXXXXXXXXXXXXXXXXX"; const serverPrefix = "XXXX"; const listId = "XXXXXX"; const url = `https://${serverPrefix}.api.mailchimp.com/3.0/lists/${listId}/members`; const headers = { Authorization:
apikey ${apiKey}
, }; const data = { email_address: "example@examplr", status: "subscribed", merge_fields: { FNAME: "Elinore", LNAME: "Grady", BIRTHDAY: "01/22", } }; axios.post(url, data, { headers }) .then(response => { console.log(response.data); }) .catch(error => { console.error("Error:", error.response.data); });
did you get it working?