I am trying to post a file to sendinblue using API in Python and struggling with what to put instead of "dataset1". It works if I manually type the file contents but not if I specify a file - I have tried csv, json, txt formats but nothing works. The error message says 'We could not find any valid email or SMS in the file you uploaded', I think it doesn't like the 'filebody' format.
My code below: Any help greatly appreciated!
import requests
url = "https://api.sendinblue.com/v3/contacts/import"
payload = {
"listIds": [12],
"emailBlacklist": False,
"smsBlacklist": False,
"updateExistingContacts": True,
"emptyContactsAttributes": False,
"fileBody": "dataset1"
headers = {
"accept": "application/json",
"content-type": "application/json",
"api-key": "APIKEY"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)