This package provides a simple wrapper around the Sendinblue API.
⚠️ This package is not an official package from Sendinblue.
This package was initially built for a specific small project I was working for and was not intended to be an open source one.
Re-thinking about this, I thought that I should publish it to pub.dev anyway, as it could help others.
That is why, for the moment, the number of functions is quite small (compared to what the official API provides us)
Feel free to contribute or mention me if you need other wrappers.
- Create a contact
- Get all contacts
- Get contacts with pagination
- Get contact detail
- Delete a contact
- Add contact in emails black list
- Remove contact from emails black list
- Update contact properties
All you need to start playing with the API is to initialise the package with your API key like this :
Sendinblue.initialize(
configuration: SendinblueConfiguration(apiKey: 'your-api-key'),
);
This initialisation can be done at any time but must be done before any other call.
- Create a contact
final int contactId = await Sendinblue.instance.createContact(email: '[email protected]');
- Get all contacts
final List<Contact> contacts = await Sendinblue.instance.getAllContacts();
- Get contacts with pagination
final List<Contact> contacts = await Sendinblue.instance.getContacts(offset: 0, limit: 50);
- Get a specific contact by email
final Contact contact = await Sendinblue.instance.getContact(email: '[email protected]');
- Delete a contact by email
await Sendinblue.instance.deleteContact(email: '[email protected]');
- Add contact in email black list
await Sendinblue.instance.addContactInEmailsBlackList(email: '[email protected]');
- Remove contact of email black list
await Sendinblue.instance.removeContactFromEmailsBlackList(email: '[email protected]');
- Update contact properties
await Sendinblue.instance.updateContactProperties(
email: '[email protected]',
properties: {
'name': 'John',
'premium': true,
},
);
Please note that the Sendinblue API will update properties only if they are already created on the platform (we could also use the API but it is not implemented in this package for the moment)
💡 You could have some "Date" attributes on Sendinblue. Please note that Sendinblue API is waiting for 'YYYY-MM-DD' formatted dates. In order to facilitate this usage,the package includes an extension on DateTime :
DateTime(2021, 1, 1).toSendinBlueFormat(); // '2021-01-01'
For more information on what could be done with this package, here is the official Sendinblue document with all the APIs : https://developers.sendinblue.com/reference