Hagrid_
Hagrid_

Reputation: 27

API BREVO Create contact

I tried using Python to create contacts in Brevo.

There's an interesting resource on this site: https://developers.brevo.com/reference/createcontact

The site allows you to try a direct online request after entering your API KEY.

When I try to run this suggested code model :

import requests

url = "https://api.brevo.com/v3/contacts"

payload = {
    "email": "[email protected]",
    "ext_id": "externalId",
    "attributes": {
        "FNAME": "Elly",
        "LNAME": "Roger",
        "COUNTRIES": ["India", "China"]
    },
    "emailBlacklisted": False,
    "smsBlacklisted": False,
    "listIds": [36],
    "updateEnabled": False,
    "smtpBlacklistSender": ["[email protected]"]
}
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "api-key": "123456"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
}

Creation of the contact is OK but without the attributes (FNAME, LNAME, COUNTRIES). This is the example of the website!

I get the same result with my python code

Do you have any ideas? Is there a restriction in the free plan?

Upvotes: 0

Views: 56

Answers (0)

Related Questions