From the Trenches: Apply your brand to your Docusign emails
See how to use the eSignature REST API to create and apply a brand using either Postman calls or C#.
In this blog post, I will show you how to create and customize the branding in your envelopes using both Postman and C#.
Using the Branding function, you may alter the appearance and feel of the emails and envelopes you send out for signatures. Branding lets you apply your own logos and colors to your envelopes, so you can give your integration's eSignature sending and signing views a visual style to match your company. This helps you keep the user experience consistent with your company.
Docusign offers two ways to create and apply brands: through the Docusign eSignature web app and through the API. You can find more info on each method here:
Creating a custom brand for both the sending and signing view
To use the createBrand API/SDK method, the canSelfBrandSign
and canSelfBrandSend
settings must be enabled at the account level. You must be an eSignature administrator with full administration permissions to manage these settings.
Creating a brand in Postman:
POST {{baseurl}}/restapi/v2.1/accounts/{{accountId}}/brands
{
"brandCompany": "DocuSignTest",
"brandLanguages": [
"en","ko"
],
"brandName": "Test",
"defaultBrandLanguage": "en",
"isSigningDefault": true,
"isSendingDefault": true
}
Creating a brand in C#:
public void CreateBrand(DocuSignClient apiClient)
{
Console.WriteLine("==> CreateBrand started...");
string accountId = "d6050fbc-xxxx-xxxx-xxxx-88f5cf6daacb";
string brandName = "Test";
string defaultBrandLanguage = "en";
// Construct your request body
Brand newBrand = new Brand
{
BrandName = brandName,
DefaultBrandLanguage = defaultBrandLanguage,
};
// Create an instance of the Accounts API
AccountsApi accountsApi = new AccountsApi(apiClient);
// Call the CreateBrand method
BrandsResponse CreateBrand = accountsApi.CreateBrand(accountId, newBrand );
Console.WriteLine("==> Created Brand successfully!!, response:\n" + JsonConvert.SerializeObject(CreateBrand));
}
}
Update existing brand properties
Using the updateBrand method, you can update the existing properties of your brand, such as: color, name, brand language, email content, landing pages, links and logos.
Updating a brand in Postman:
Put https://{{baseUrl}}/restapi/v2.1/accounts/{{accountId}}/brands/{{brandId}}
{
"brandCompany": "DocuSigntest",
"brandId": "bee3e947-xxxx-xxxx-xxxx-46cbf16728d6",
"brandLanguages": [
"es"
],
"brandName": "Test",
"colors": [
{
"name": "buttonPrimaryBackground",
"originalValue": "#00FF00",
"value": "#00FFFF"
}
],
"defaultBrandLanguage": "es",
"isSendingDefault": true,
"isSigningDefault": true
}
Updating a brand in C#:
public void UpdateBrand(DocuSignClient apiClient)
{
Console.WriteLine("==> UpdateBrand started...");
string accountId = "d6050fbc-xxxx-xxxx-xxxx-88f5cf6daacb";
string brandId = "bee3e947-xxxx-xxxx-xxxx-46cbf16728d6";
List<namevalue> colors = new List<namevalue> {
new NameValue { Name = "buttonPrimaryBackground", OriginalValue = "#FFC820", Value = "#00FF00" },
new NameValue { Name = "buttonPrimaryText", OriginalValue = "#333333", Value = "#FF0200" },
new NameValue { Name = "headerBackground", OriginalValue = "#214E9F", Value = "#F6B26B" },
};
// Create an instance of the AccountsApi
AccountsApi accountsApi = new AccountsApi(apiClient);
// Retrieve the existing brand details
Brand brand = accountsApi.GetBrand(accountId, brandId);
// Modify the brand details
brand.BrandName = "Test";
brand.DefaultBrandLanguage = "en";
//Other languages are also available; see the brandLanguages property at https://developers.docusign.com/docs/esign-rest-api/reference/accounts/accountbrands/create/
// Call updateBrand colors
brand.Colors = colors;
// Create the update options
AccountsApi.UpdateBrandOptions options = null;
// Call the UpdateBrand method
Brand updatedBrand = accountsApi.UpdateBrand(accountId, brandId, brand, options);
Console.WriteLine("==> Brand updated successfully!!, response:\n" + JsonConvert.SerializeObject(updatedBrand));
}</namevalue></namevalue>
Update your branding resource files
A sophisticated technique for modifying your Docusign sending, signature, and email brands is to update your branding resource files. One master resource file is used by Docusign for email communications, and the other one is used for the signature process. These resource files configure and set different text elements used in email messages and the signing process. Additionally, some of the dialog boxes are controlled by the signature resource file.
The custom signing brand in your account contains both resource files. To update a resource file, call the updateBrandResourcesByContentType method, specifying the resource type to control which file will be updated. For more information and support, speak with your account manager or Docusign Support if the resource file option is not enabled for your account.
Updating a resource file in Postman:
https://{{baseUrl}}/restapi/v2.1/accounts/{{accountId}}/brands/{{brandId}}/resources/resourcecontenttype
With binary file as shown:
Updating a resource file in C#:
public void UpdateBrandResourcesByContentType(DocuSignClient apiClient)
{
Console.WriteLine("==> UpdateBrandResourcesByContentType started...");
string accountId = "d6050fbc-xxxx-xxxx-xxxx-88f5cf6daacb";
string brandId = "bee3e947-xxxx-xxxx-xxxx-46cbf16728d6";
string resourceContentType = "email";
string filePath = @"C:\Users\folder\Downloads\resourcefile.Xml";
Console.WriteLine("==> updateresourcecontent...");
// Read the file content as bytes
byte[] fileXml = System.IO.File.ReadAllBytes(filePath);
// Create an instance of the AccountsApi
AccountsApi accountsApi = new AccountsApi(apiClient);
// Retrieve the existing brand details
BrandResourcesList brandResources = accountsApi.GetBrandResources(accountId, brandId);
// Modify the resourceContentType details
resourceContentType = "email";
// Call the UpdateBrandResourcesByContentType method
BrandResources UpdateBrandResourcesByContentType = accountsApi.UpdateBrandResourcesByContentType(accountId, brandId, resourceContentType, fileXml);
Console.WriteLine("==> updated ResourceContentType successfully!!, response:\n" + JsonConvert.SerializeObject(UpdateBrandResourcesByContentType));
}
Additional resources
Sai Dandamudi has been with Docusign since 2022. Her work is focused in helping developers resolve issues they encounter when developing applications using Docusign APIs and advising developers on how to integrate with Docusign APIs and SDKs by consulting on best practices and providing code examples. You can reach out to Sai through Linkedin.
Related posts