findOrCreateLabel( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a label with a given name, or creates one if it doesn't exist.

The findOrCreateLabel() function returns a Promise that resolves when the specified label is found or created.

Successful calls to findOrCreateLabel() always returns a label, which can be passed to subsequent function calls.

To find an existing label without potentially creating a new one, use getLabel() or queryLabels().

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Contact Labels
Manage Members and Contacts - all permissions
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
displayNamestringRequired

Display name to retrieve or create.

If an existing label is an exact match for the specified display name, the existing label is returned. If not, a new label is created and returned.


optionsFindOrCreateLabelOptions

Language options.

Returns
Return Type:Promise<FindOrCreateLabelResponse>
Did this help?