Urgent.News

What's breaking now, across thousands of outlets.

Tech

Find your Brevo list ID and add contacts to it with plain Node.js fetch

A code-first version of a guide first published on Omni Genz . Almost every Brevo (formerly Sendinblue) integration asks for a list ID sooner or later: a WordPress form plugin, a Zapier step, or your own sign-up endpoint. This post shows how to find it in the dashboard, how to look it up with the API, and how to put new and existing contacts into that list from Node 18+ using only the built-in…

To use Brevo (formerly Sendinblue) with Node.js, first locate the list ID in your Brevo dashboard. This ID appears next to or under each list name, or can be found by accessing the list URL. Remember, this is not the same as a segment ID.

For security, store your Brevo API key in an environment variable rather than hardcoding it into your code. This can be done using the export command in a Unix-based system.

To interact with the Brevo API, create a brevo.js file that defines a fetch wrapper function. This function takes a path and an optional method and body, sets the appropriate headers including the API key, and parses the response.

A second file, lists.js, uses the brevo.js function to retrieve all lists from Brevo. It makes a GET request to /contacts/lists, handling pagination by incrementing the offset parameter. The list IDs and names are then logged to the console.

Finally, a subscribe.js file demonstrates how to add a new contact to a list. It uses a POST request to /contacts, passing the email and first name, and specifies the desired list ID in the listIds array. The updateEnabled flag ensures existing contacts are updated instead of failing.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

DevSecOps Pipeline from Scratch: Gates That Block Bad Code

"We want to shift security left. Walk me through how you would build a DevSecOps pipeline from scratch for a Kubernetes-based microservices stack." Naming tools does not answer it.

  • Implement secrets detection via pre-commit hook scanning for keys, tokens, and passwords
  • Enforce static application security testing (SAST) on every pull request with pr-security job
  • Use Trivy for software composition analysis (SCA) and image scanning, blocking unsigned images

Nix store signatures cover substitution trust, not every build input

Nix store signatures cover substitution trust, not every build input Nix stores build outputs as paths with hashes and metadata.

  • Nix store signatures verify path integrity but not every build input
  • Default require-sigs is true, rejecting unsigned non-content-addressed paths
  • Trusted keys have same trust level as keys signing legitimate paths

More from Monday 2 November →