Trending Topics: Latest from our forums (January 2024)

Here are some of the latest popular questions that the Docusign developers community asked on Stack Overflow in the month of January 2024. You too can ask questions by using the tag docusignapi in Stack Overflow.

Thread: Create envelope with template id and values for custom and standard fields should be filled before sending to recipients

Summary: The developer is writing code that will send envelopes created from templates and also fill some of the values in the tabs that are in these envelopes before sending them to recipients. Their code worked, but the values were not filled.

Answer: There were two issues specific to the code the developer provided in their question. First, they had to use the recipient roles to specify template recipients and provide the tab values based on the recipient roles provided in the template. If sending from an envelope, you directly specify the recipients; but from template, you will have to use roles for placeholder recipients that are not specific to the template itself.

The second issue had to do with CompanyTabs, which are different types of tabs whose value  developers cannot directly set. That value must come from the recipient directly. 

Thread: How to show a previously signed document to the next signer?

Summary: The developer is trying to send an envelope to two signers. They want the first signer to see the documents and signatures of the second signer, but not vice versa. 

Answer: Normally when Docusign sends an envelope to multiple recipients, there’s a routing order that takes place. So subsequent recipients can typically see the tabs that prior recipients placed or edited in the envelope. The exception to this is when using the Document Visibility feature. This feature enables you to hide certain documents from certain recipients. By using this feature, you can have full control over which recipients can view which documents, including the tabs that were placed inside these documents.

Thread: Docusign: token from requestJWTApplicationToken returns 401 AUTHORIZATION_INVALID_TOKEN when createEnvelope is called

Summary: The developer is using the Node.js SDK and is attempting to create an envelope using the eSignature API after they obtain an access token using JSON Web Token (JWT) Grant. They are getting an error and are not sure why.

Answer: This is the Node.js code that the developer was trying to use to obtain an access token:

import * as docusign from 'docusign-esign';
const expiresIn = 28800;
export const createClient = async (): Promise<docusign.ApiClient> => {
  const apiClient = new docusign.ApiClient({ basePath: process.env.BASE_PATH, oAuthBasePath: process.env.O_AUTH_BASE_PATH });
  try {
    const response = await apiClient.requestJWTApplicationToken(
      ["signature", "impersonation"],
      Buffer.from(process.env.RSA_PRIVATE_KEY.replace(/\\n/g, '\n')),
    console.log(response.body.access_token) // -> successfully returns access token
    apiClient.addDefaultHeader("Authorization", "Bearer " + response.body.access_token);
  } catch (error){ throw AppError("My custom error") }
  return apiClient;

Note that they used the call to apiClient.requestJWTApplicationToken, which is the method that you use when you are building an integration for an entire organization where consent would be provided not per user, but for the entire organization and all accounts in it. This requires additional configuration, including registration of a domain and creating an organization. The other way to obtain access tokens using JWT in the Node.js SDK is using the method apiClient.requestJwtUserToken, which only requires consent at the user level and is usually easier for developers to start with.

Additional resources

Inbar Gazit
Inbar Gazit
Sr. Manager, Developer Content