# đź› technical-support
YFS
YFS·20 replies

Hey Guys, I still can't get my contacts into Brevo.

Can you support me on this please

Thats the script: const token = CONFIG.BREVO_API_KEY; let list_id = CONFIG.BREVO_LIST_ID; list_id = Number(list_id);

const API_ENDPOINT = "https://api.brevo.com/v3/contacts"; const HEADERS = { 'content-type': 'application/json', 'accept': 'application/json', 'api-key': token };

let email = CONTACT.email || ""; let first_name = CONTACT.name ? CONTACT.name : (CONTACT.email ? CONTACT.email.split("@")[0] : "");

let raw = JSON.stringify({ "email": email, "attributes": { "FNAME": first_name }, "listIds": [list_id] })

const OPTIONS = { method: "POST", headers: HEADERS, body: raw, redirect: "follow" };

async function createContact() { const response = await fetch(API_ENDPOINT, OPTIONS).then(res => res.text()); return response; }

try { let contact = await createContact(); return console.log("Contact Data", contact); } catch (error) { return console.log("Error Occured", error.message); }

I have added my IP to Brevo I have added the API to YourGPT

Ankur | YourGPT
Ankur | YourGPT04/08/2025 11:44

You're welcome to book a demo using the link provided. In the meantime, if you can share the specific assistance you need, I'd be happy to help you right away.

https://cal.com/yourgpt/demo?utm_campaign=visit&utm_medium=website&utm_source=home

standard1
YFS
YFS04/08/2025 12:09

i still can't get the brevo connection running.

I still can't get my contacts into Brevo.

Can you support me on this please

Thats the script: const token = CONFIG.BREVO_API_KEY; let list_id = CONFIG.BREVO_LIST_ID; list_id = Number(list_id);

const API_ENDPOINT = "https://api.brevo.com/v3/contacts"; const HEADERS = { 'content-type': 'application/json', 'accept': 'application/json', 'api-key': token };

let email = CONTACT.email || ""; let first_name = CONTACT.name ? CONTACT.name : (CONTACT.email ? CONTACT.email.split("@")[0] : "");

let raw = JSON.stringify({ "email": email, "attributes": { "FNAME": first_name }, "listIds": [list_id] })

const OPTIONS = { method: "POST", headers: HEADERS, body: raw, redirect: "follow" };

async function createContact() { const response = await fetch(API_ENDPOINT, OPTIONS).then(res => res.text()); return response; }

try { let contact = await createContact(); return console.log("Contact Data", contact); } catch (error) { return console.log("Error Occured", error.message); }

I have added my IP to Brevo I have added the API to YourGPT

i'll need someone to check with me on a call i guess. if you can check it for me would be great as well

Ankur | YourGPT
Ankur | YourGPT04/08/2025 12:27

The issue in your code is with this line: let contact = await createContact();. Since await doesn't work at the top level without an async function, you should use .then() instead.

  .then(data => { 
    return JSON.parse(data);  
  } )
  .then(contact => { 
    console.log("Contact Data", contact);
   })```
YFS
YFS04/08/2025 12:34

ok thanks. let me test

YFS
YFS04/08/2025 13:25

this is the upadted script

const token = CONFIG.BREVO_API_KEY; let list_id = CONFIG.BREVO_LIST_ID; list_id = Number(list_id);

const API_ENDPOINT = "https://api.brevo.com/v3/contacts"; const HEADERS = { 'content-type': 'application/json', 'accept': 'application/json', 'api-key': token };

let email = CONTACT.email || ""; let first_name = CONTACT.name ? CONTACT.name : (CONTACT.email ? CONTACT.email.split("@")[0] : ""); let country = CONTACT.country || ""; // country will be sent as LASTNAME

let raw = JSON.stringify({ "email": email, "attributes": { "FNAME": first_name, "LASTNAME": country // country mapped to LASTNAME }, "listIds": [list_id] })

const OPTIONS = { method: "POST", headers: HEADERS, body: raw, redirect: "follow" };

async function createContact() { const response = await fetch(API_ENDPOINT, OPTIONS).then(res => res.text()); return response; }

createContact()

.then(data => { return JSON.parse(data);
} ) .then(contact => { console.log("Contact Data", contact); }) .catch(error => { console.log("Error Occured", error.message); });

i can't make it work.

YFS
YFS04/08/2025 13:27

also i get this error message

translated: it need a @ in the email.

Ankur | YourGPT
Ankur | YourGPT04/08/2025 13:29

The issue in this code is the missing ||.

let email = CONTACT.email || "";
let first_name = CONTACT.name ? CONTACT.name : (CONTACT.email ? CONTACT.email.split("@")[0] : "");
let country = CONTACT.country || ""; // country will be sent as LASTNAME

Other than that, the code is working correctly and successfully created the contact.

Ankur | YourGPT
Ankur | YourGPT04/08/2025 13:44

It's already saved. Our team is currently working on UI improvements, and this will be resolved soon.

standard1
YFS
YFS04/08/2025 13:50

alright. sadly, the contact i still not in Brevo

YFS
YFS04/08/2025 14:08

atm i can't access the studio.

YFS
YFS04/08/2025 14:08

do you know why?

Ankur | YourGPT
Ankur | YourGPT04/08/2025 14:13

Our development team is actively working on this fix. We'll notify you with an update as soon as it's resolved.

Ankur | YourGPT
Ankur | YourGPT04/08/2025 14:16

Our team is currently investigating the issue in your chatbot, which is why you're seeing the "No Access" message.

YFS
YFS04/08/2025 14:40

ok thanks

YFS
YFS04/08/2025 14:52

let me know when your done pls

YFS
YFS05/08/2025 05:22

@Ankur Hey Ankur, hope you're and you had a successfull update yesterday. can we please fix the issue today?

YFS
YFS05/08/2025 05:23

in case you do not have time today, i have booked a call for tomorrow.

Ankur | YourGPT
Ankur | YourGPT06/08/2025 10:59

Hi @YFS – The API issue has been resolved. You can now test it using the updated code.

const token = CONFIG.BREVO_API_KEY;
let list_id = CONFIG.BREVO_LIST_ID;
list_id = Number(list_id);

const API_ENDPOINT = "https://api.brevo.com/v3/contacts";
const HEADERS = {
  'content-type': 'application/json',
  'accept': 'application/json',
  'api-key': token
};

// Use existing CONTACT object or fallback
let email = CONTACT.email || "johnDoe@gmail.com";
let first_name = CONTACT.name || (CONTACT.email ? CONTACT.email.split("@")[0] : "John");
let country = CONTACT.country || "";

let raw = JSON.stringify({
  email: email,
  attributes: {
    FNAME: first_name,
    LASTNAME: country
  },
  listIds: [list_id]
});

const OPTIONS = {
  method: "POST",
  headers: HEADERS,
  body: raw,
  redirect: "follow"
};

async function createContact() {
  try {
    const response = await fetch(API_ENDPOINT, OPTIONS);
    const data = await response.json();
    return { success: response.ok, status: response.status, data: data };
  } catch (error) {
    console.error('Fetch Error:', error);
    throw error;
  }
}

// Call the function
const result = await createContact();
if (result.success) {
  console.log('âś… Contact created successfully:', result.data);
} else {
  console.log('❌ Failed to create contact:', result.data);
}
YFS
YFS06/08/2025 11:20

thanks for the work. in the meantime i have solved the brevo integration with embeded domains.

standard1
YFS
YFS06/08/2025 11:20

i'll check it out later