Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jupyter-naas
GitHub Repository: jupyter-naas/awesome-notebooks
Path: blob/master/Brevo/Brevo_Create_contact.ipynb
2973 views
Kernel: Python 3

Naas

Brevo - Create a contact

Give Feedback | Bug report

Tags: #brevo #contacts #create #snippet

Last update: 2024-05-30 (Created: 2024-05-30)

Description: This notebook creates a contact in Brevo.

Input

Import libraries

import requests

Setup variables

  • api_key: Brevo API Key

  • payload: Payload

api_key = "YOUR_BREVO_API_KEY" payload = { "email": "", "attributes": {}, "listIds": [], }

Model

Create a contact

def create_contact(api_key, data): url = "https://api.brevo.com/v3/contacts" headers = { "api-key": api_key, "accept": "application/json", "content-type": "application/json" } res = requests.post(url, headers=headers, json=payload) if res.status_code == 200: return res.json() result = create_contact(api_key, contact_data) print(result)

Output

Display result

result