### Getting Started with Brevo API v3 C# SDK Source: https://github.com/getbrevo/brevo-csharp/blob/master/README.md Configure API keys and retrieve account information using the AccountApi. Ensure API keys are correctly set in Configuration.Default.ApiKey. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class Example { public void main() { // Configure API key authorization: api-key Configuration.Default.ApiKey.Add("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.ApiKeyPrefix.Add("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.ApiKey.Add("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.ApiKeyPrefix.Add("partner-key", "Bearer"); var apiInstance = new AccountApi(); try { // Get your account information, plan and credits details GetAccount result = apiInstance.GetAccount(); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling AccountApi.GetAccount: " + e.Message ); } } } } ``` -------------------------------- ### Get Subscription Balances with Brevo C# SDK Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/BalanceApi.md This example shows how to fetch subscription balances for a given contact ID and loyalty program. API keys must be configured, and the contact ID must be provided. Includes error handling for the API request. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class GetSubscriptionBalancesExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new BalanceApi(); var cid = cid_example; // string | Contact Id var pid = new Guid?(); // Guid? | Loyalty Program Id try { // Get subscription balances ModelSubscriptionBalanceResp result = apiInstance.GetSubscriptionBalances(cid, pid); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling BalanceApi.GetSubscriptionBalances: " + e.Message ); } } } } ``` -------------------------------- ### Get Domains List Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/DomainsApi.md This example demonstrates how to retrieve a list of all domains associated with your Brevo account using the C# SDK. ```APIDOC ## GET /domains ### Description Retrieves a list of all domains associated with the Brevo account. ### Method GET ### Endpoint /domains ### Parameters This endpoint does not require any parameters. ### Request Body This endpoint does not accept a request body. ### Request Example ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class GetDomainsExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new DomainsApi(); try { // Get the list of all your domains GetDomainsList result = apiInstance.GetDomains(); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling DomainsApi.GetDomains: " + e.Message ); } } } } ``` ### Response #### Success Response (200) - **GetDomainsList** (GetDomainsList) - Details about the domains. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Get All Domains using Brevo C# SDK Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/DomainsApi.md Use this snippet to retrieve all your registered domains. Ensure your API keys are correctly configured before execution. This example uses both 'api-key' and 'partner-key' for authorization. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class GetDomainsExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new DomainsApi(); try { // Get the list of all your domains GetDomainsList result = apiInstance.GetDomains(); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling DomainsApi.GetDomains: " + e.Message ); } } } } ``` -------------------------------- ### Get WhatsApp Templates Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/WhatsAppCampaignsApi.md This example demonstrates how to retrieve a list of your created WhatsApp templates using the Brevo C# SDK. It shows how to configure API keys and set various filtering and sorting parameters. ```APIDOC ## GET /getbrevo/brevo-csharp ### Description Retrieves a list of all created WhatsApp templates. ### Method GET ### Endpoint /whatsapp/templates ### Parameters #### Query Parameters - **startDate** (string) - Optional - Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. Prefer to pass your timezone in date-time format for accurate result. - **endDate** (string) - Optional - Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. Prefer to pass your timezone in date-time format for accurate result. - **limit** (long?) - Optional - Number of documents per page (default to 50). - **offset** (long?) - Optional - Index of the first document in the page (default to 0). - **sort** (string) - Optional - Sort the results in the ascending/descending order of record modification. Default order is descending if `sort` is not passed (default to desc). - **source** (string) - Optional - Source of the template. ### Request Example ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class GetWhatsAppTemplatesExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new WhatsAppCampaignsApi(); var startDate = "2023-01-01T00:00:00Z"; // Example startDate var endDate = "2023-12-31T23:59:59Z"; // Example endDate var limit = 100; // Example limit var offset = 0; // Example offset var sort = "asc"; // Example sort var source = "brevo"; // Example source try { // Return all your created WhatsApp templates GetWATemplates result = apiInstance.GetWhatsAppTemplates(startDate, endDate, limit, offset, sort, source); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling WhatsAppCampaignsApi.GetWhatsAppTemplates: " + e.Message ); } } } } ``` ### Response #### Success Response (200) - **GetWATemplates** (GetWATemplates) - An object containing the list of WhatsApp templates. #### Response Example ```json { "templates": [ { "id": 123, "name": "my_template", "status": "approved", "category": "utility", "language": { "iso": "en", "name": "English" }, "content": { "type": "text", "body": "Hello {{1}}!" }, "createdAt": "2023-10-27T10:00:00Z", "updatedAt": "2023-10-27T10:00:00Z" } ], "count": 1 } ``` ### Authorization - api-key - partner-key ``` -------------------------------- ### Upload Image to Gallery C# Example Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/EmailCampaignsApi.md This example demonstrates how to upload an image to your Brevo account's image gallery. API keys must be set up prior to execution. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class UploadImageToGalleryExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new EmailCampaignsApi(); var uploadImage = new UploadImageToGallery(); // UploadImageToGallery | Parameters to upload an image try { // Upload an image to your account's image gallery UploadImageModel result = apiInstance.UploadImageToGallery(uploadImage); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling EmailCampaignsApi.UploadImageToGallery: " + e.Message ); } } } } ``` -------------------------------- ### Get Account Activity Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/MasterAccountApi.md This example demonstrates how to retrieve user activity logs from your Brevo account using the C# SDK. It shows how to configure API keys and make the `GetAccountActivity` call with optional parameters like date range and email filtering. ```APIDOC ## GET /account/activity ### Description Retrieves user activity logs from your Brevo account. ### Method GET ### Endpoint /account/activity ### Parameters #### Query Parameters - **startDate** (string) - Optional - Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. - **endDate** (string) - Optional - Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. - **email** (string) - Optional - Enter the user's email address to filter their activity in the account. - **limit** (long) - Optional - Number of documents per page (default to 10). - **offset** (long) - Optional - Index of the first document in the page. (default to 0). ### Request Example ```csharp // Configuration and API key setup Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); var apiInstance = new MasterAccountApi(); var startDate = "2023-01-01"; // Example start date var endDate = "2023-01-31"; // Example end date var email = "user@example.com"; // Example email var limit = 50; // Example limit var offset = 0; // Example offset try { GetAccountActivity result = apiInstance.GetAccountActivity(startDate, endDate, email, limit, offset); // Process the result } catch (Exception e) { // Handle exception } ``` ### Response #### Success Response (200) - **GetAccountActivity** (GetAccountActivity) - Contains the user activity logs. #### Response Example ```json { "transactions": [ { "id": 123, "email": "user@example.com", "date": "2023-01-15T10:00:00Z", "type": "send", "from": "sender@example.com", "to": "user@example.com", "subject": "Test Email", "campaignId": 456 } ], " 0": 1 } ``` ``` -------------------------------- ### Get Shared Template URL C# Example Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/EmailCampaignsApi.md Demonstrates how to obtain a unique URL to share an email template between Brevo accounts. Ensure API keys are configured correctly. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class GetSharedTemplateUrlExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new EmailCampaignsApi(); var campaignId = 789; // long? | Id of the campaign or template try { // Get a shared template url GetSharedTemplateUrl result = apiInstance.GetSharedTemplateUrl(campaignId); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling EmailCampaignsApi.GetSharedTemplateUrl: " + e.Message ); } } } } ``` -------------------------------- ### Get Lists in a Folder - C# Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/ContactsApi.md This example shows how to retrieve all lists within a specified folder. Optional parameters for limit, offset, and sorting can be used to refine the results. Ensure API keys are configured. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class GetFolderListsExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new ContactsApi(); var folderId = 789; // long? | Id of the folder var limit = 789; // long? | Number of documents per page (optional) (default to 10) var offset = 789; // long? | Index of the first document of the page (optional) (default to 0) var sort = sort_example; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional) (default to desc) try { // Get lists in a folder GetFolderLists result = apiInstance.GetFolderLists(folderId, limit, offset, sort); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling ContactsApi.GetFolderLists: " + e.Message ); } } } } ``` -------------------------------- ### GET /products Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/EcommerceApi.md Return all your products. ```APIDOC ## GET /products ### Description Return all your products. ### Method GET ### Endpoint /products ### Parameters #### Query Parameters - **limit** (int) - Optional - Number of documents per page. - **offset** (int) - Optional - Tuple to specify the exact records to the list. - **sort** (string) - Optional - Sort the results by attribute name. Default value is 'desc'. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **products** (list[Product]) - List of products. - **total** (int) - Total number of products. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Get Products Source: https://github.com/getbrevo/brevo-csharp/blob/master/README.md Retrieves a list of available products. ```APIDOC ## GET /getProducts ### Description Retrieves a list of available products. ### Method GET ### Endpoint /getProducts ``` -------------------------------- ### Get Corporate User Permission C# Example Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/MasterAccountApi.md This example demonstrates how to check the admin user permissions for a specific user's email address. API keys must be configured prior to use. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class GetCorporateUserPermissionExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new MasterAccountApi(); var email = email_example; // string | Email of the invited user try { // Check admin user permissions GetCorporateUserPermission result = apiInstance.GetCorporateUserPermission(email); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling MasterAccountApi.GetCorporateUserPermission: " + e.Message ); } } } } ``` -------------------------------- ### Create Coupons using Brevo C# SDK Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/CouponsApi.md This code example demonstrates how to create coupons for an existing coupon collection using the Brevo C# SDK. It requires proper API key configuration and a CreateCoupons object. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class CreateCouponsExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new CouponsApi(); var createCoupons = new CreateCoupons(); // CreateCoupons | Values to create coupons try { // Create coupons for a coupon collection apiInstance.CreateCoupons(createCoupons); } catch (Exception e) { Debug.Print("Exception when calling CouponsApi.CreateCoupons: " + e.Message ); } } } } ``` -------------------------------- ### GET /senders/domains/{domainName} - GetDomainConfiguration Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/DomainsApi.md Retrieves the configuration details for a specific domain. This is useful for verifying the setup and ensuring it's ready for sending. ```APIDOC ## GET /senders/domains/{domainName} ### Description Validates the configuration of a domain. ### Method GET ### Endpoint /senders/domains/{domainName} ### Parameters #### Path Parameters - **domainName** (string) - Required - The name of the domain to validate. ### Response #### Success Response (200) - **DomainConfiguration** (object) - An object containing the domain's configuration details, including DNS records and authentication status. #### Response Example ```json { "domain": "example.com", "dkim": { "status": "valid", "records": [ { "name": "selector._domainkey.example.com", "type": "CNAME", "value": "selector.dkim.example.com" } ] }, "spf": { "status": "valid", "records": [ { "name": "example.com", "type": "TXT", "value": "v=spf1 include:spf.brevo.com -all" } ] } } ``` ### Authorization - api-key - partner-key ``` -------------------------------- ### Get SMS Campaign C# Example Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/SMSCampaignsApi.md Retrieve details for a specific SMS campaign using its ID. This requires valid API key configuration. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class GetSmsCampaignExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new SMSCampaignsApi(); var campaignId = 789; // long? | id of the SMS campaign try { // Get an SMS campaign GetSmsCampaign result = apiInstance.GetSmsCampaign(campaignId); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling SMSCampaignsApi.GetSmsCampaign: " + e.Message ); } } } } ``` -------------------------------- ### Create Email Campaign with Brevo C# SDK Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/EmailCampaignsApi.md Demonstrates how to create a new email campaign using the EmailCampaignsApi. Ensure API keys are configured before execution. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class CreateEmailCampaignExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new EmailCampaignsApi(); var emailCampaigns = new CreateEmailCampaign(); // CreateEmailCampaign | Values to create a campaign try { // Create an email campaign CreateModel result = apiInstance.CreateEmailCampaign(emailCampaigns); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling EmailCampaignsApi.CreateEmailCampaign: " + e.Message ); } } } } ``` -------------------------------- ### Get Domain Configuration using C# Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/DomainsApi.md Retrieve the configuration details for a specific domain. This is useful for validating domain setup. Authentication with API or partner keys is required. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class GetDomainConfigurationExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new DomainsApi(); var domainName = domainName_example; // string | Domain name try { // Validate domain configuration GetDomainConfigurationModel result = apiInstance.GetDomainConfiguration(domainName); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling DomainsApi.GetDomainConfiguration: " + e.Message ); } } } } ``` -------------------------------- ### Get a CRM Note using C# Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/NotesApi.md This example shows how to retrieve a specific note from your Brevo CRM using its ID. It includes API key configuration and error handling. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class CrmNotesIdGetExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new NotesApi(); var id = id_example; // string | Note ID to get try { // Get a note Note result = apiInstance.CrmNotesIdGet(id); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling NotesApi.CrmNotesIdGet: " + e.Message ); } } } } ``` -------------------------------- ### Create Contact List in C# Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/ContactsApi.md This example shows how to create a new contact list. API keys must be configured prior to calling this method. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class CreateListExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new ContactsApi(); var createList = new CreateList(); // CreateList | Values to create a list try { // Create a list CreateModel result = apiInstance.CreateList(createList); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling ContactsApi.CreateList: " + e.Message ); } } } } ``` -------------------------------- ### POST /products/batch Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/EcommerceApi.md Create products in batch. ```APIDOC ## POST /products/batch ### Description Create products in batch. ### Method POST ### Endpoint /products/batch ### Parameters #### Request Body - **productBatch** (ProductBatch) - Required - Description of the product batch object. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **void** - Empty response body. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Delete Folder Example in C# Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/ContactsApi.md Demonstrates how to delete a folder and its associated lists using the Brevo C# SDK. Ensure API keys are configured correctly before execution. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class DeleteFolderExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new ContactsApi(); var folderId = 789; // long? | Id of the folder try { // Delete a folder (and all its lists) apiInstance.DeleteFolder(folderId); } catch (Exception e) { Debug.Print("Exception when calling ContactsApi.DeleteFolder: " + e.Message ); } } } } ``` -------------------------------- ### Get Corporate Invited Users List C# Example Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/MasterAccountApi.md This snippet shows how to retrieve a list of all invited users within a corporate account. Ensure API keys are configured before execution. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class GetCorporateInvitedUsersListExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new MasterAccountApi(); try { // Get the list of all admin users GetCorporateInvitedUsersList result = apiInstance.GetCorporateInvitedUsersList(); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling MasterAccountApi.GetCorporateInvitedUsersList: " + e.Message ); } } } } ``` -------------------------------- ### Get a Deal using Brevo C# SDK Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/DealsApi.md Demonstrates how to retrieve a specific deal by its ID. Requires API key and partner key configuration. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class CrmDealsIdGetExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new DealsApi(); var id = id_example; // string | try { // Get a deal Deal result = apiInstance.CrmDealsIdGet(id); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling DealsApi.CrmDealsIdGet: " + e.Message ); } } } } ``` -------------------------------- ### Activate Brevo eCommerce App in C# Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/EcommerceApi.md This example shows how to activate the Brevo eCommerce application using the C# SDK. It requires valid API keys for authentication. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class EcommerceActivatePostExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new EcommerceApi(); try { // Activate the eCommerce app apiInstance.EcommerceActivatePost(); } catch (Exception e) { Debug.Print("Exception when calling EcommerceApi.EcommerceActivatePost: " + e.Message ); } } } } ``` -------------------------------- ### Get Transactional Emails List Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/TransactionalEmailsApi.md This example demonstrates how to retrieve a list of transactional emails sent using various filters such as email address, template ID, message ID, and date range. ```APIDOC ## GET /getbrevo/brevo-csharp ### Description Retrieves a list of transactional emails based on specified filters. ### Method GET ### Endpoint /getbrevo/brevo-csharp ### Parameters #### Query Parameters - **email** (string) - Optional - Mandatory if templateId and messageId are not passed. Email address to which transactional email has been sent. - **templateId** (long?) - Optional - Mandatory if email and messageId are not passed. Id of the template that was used to compose transactional email. - **messageId** (string) - Optional - Mandatory if templateId and email are not passed. Message ID of the transactional email sent. - **startDate** (string) - Optional - Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Maximum time period that can be selected is one month. - **endDate** (string) - Optional - Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. - **sort** (string) - Optional - Sort the results in the ascending/descending order of record creation. Default order is **descending**. - **limit** (long?) - Optional - Number of documents returned per page. Default is 500. - **offset** (long?) - Optional - Index of the first document in the page. Default is 0. ### Request Example ```csharp // Example C# code for configuration and API call using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class GetTransacEmailsListExample { public void main() { Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); var apiInstance = new TransactionalEmailsApi(); string email = "email_example"; long? templateId = 789; string messageId = "messageId_example"; string startDate = "startDate_example"; string endDate = "endDate_example"; string sort = "sort_example"; long? limit = 789; long? offset = 789; try { GetTransacEmailsList result = apiInstance.GetTransacEmailsList(email, templateId, messageId, startDate, endDate, sort, limit, offset); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling TransactionalEmailsApi.GetTransacEmailsList: " + e.Message ); } } } } ``` ### Response #### Success Response (200) - **GetTransacEmailsList** (GetTransacEmailsList) - Details about the transactional emails retrieved. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Get Products using Brevo C# SDK Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/EcommerceApi.md Configure API keys and retrieve products using the EcommerceApi.GetProducts method. Supports filtering by ID, name, price, categories, and modification/creation dates. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class GetProductsExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new EcommerceApi(); var limit = 789; // long? | Number of documents per page (optional) (default to 50) var offset = 789; // long? | Index of the first document in the page (optional) (default to 0) var sort = sort_example; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional) (default to desc) var ids = new List(); // List | Filter by product ids (optional) var name = name_example; // string | Filter by product name, minimum 3 characters should be present for search (optional) var priceLte = 8.14; // decimal? | Price filter for products less than and equals to particular amount (optional) var priceGte = 8.14; // decimal? | Price filter for products greater than and equals to particular amount (optional) var priceLt = 8.14; // decimal? | Price filter for products less than particular amount (optional) var priceGt = 8.14; // decimal? | Price filter for products greater than particular amount (optional) var priceEq = 8.14; // decimal? | Price filter for products equals to particular amount (optional) var priceNe = 8.14; // decimal? | Price filter for products not equals to particular amount (optional) var categories = new List(); // List | Filter by category ids (optional) var modifiedSince = modifiedSince_example; // string | Filter (urlencoded) the orders modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** (optional) var createdSince = createdSince_example; // string | Filter (urlencoded) the orders created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** (optional) try { // Return all your products GetProducts result = apiInstance.GetProducts(limit, offset, sort, ids, name, priceLte, priceGte, priceLt, priceGt, priceEq, priceNe, categories, modifiedSince, createdSince); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling EcommerceApi.GetProducts: " + e.Message ); } } } } ``` -------------------------------- ### Publish Loyalty Program C# Example Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/ProgramApi.md Use this method to publish a loyalty program. Ensure API keys are configured before execution. Handles potential exceptions during the API call. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class PublishLoyaltyProgramExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new ProgramApi(); var pid = new Guid?(); // Guid? | Loyalty Program Id try { // Publish loyalty program apiInstance.PublishLoyaltyProgram(pid); } catch (Exception e) { Debug.Print("Exception when calling ProgramApi.PublishLoyaltyProgram: " + e.Message ); } } } } ``` -------------------------------- ### Create WhatsApp Template using C# Source: https://github.com/getbrevo/brevo-csharp/blob/master/docs/WhatsAppCampaignsApi.md Demonstrates how to create a WhatsApp template using the Brevo C# SDK. Ensure API keys are configured before execution. ```csharp using System; using System.Diagnostics; using brevo_csharp.Api; using brevo_csharp.Client; using brevo_csharp.Model; namespace Example { public class CreateWhatsAppTemplateExample { public void main() { // Configure API key authorization: api-key Configuration.Default.AddApiKey("api-key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api-key", "Bearer"); // Configure API key authorization: partner-key Configuration.Default.AddApiKey("partner-key", "YOUR_PARTNER_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("partner-key", "Bearer"); var apiInstance = new WhatsAppCampaignsApi(); var whatsAppTemplates = new CreateWhatsAppTemplate(); // CreateWhatsAppTemplate | Values to create a template try { // Create a WhatsApp template CreateModel result = apiInstance.CreateWhatsAppTemplate(whatsAppTemplates); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling WhatsAppCampaignsApi.CreateWhatsAppTemplate: " + e.Message ); } } } } ```