Mega icon

Mega

Work with Mega API

Custom Attribute → Create

AI-generated

Summary

Create a new custom attribute in the Mega system for either conversations or contacts by specifying its name, key, display type, and optional properties such as description, allowed values, and validation patterns.

Inputs

  • Attribute Display Name (required) — The display name for the custom attribute shown in the Mega interface.
  • Attribute Display Type — Type of data the custom attribute holds (e.g., Text, Number, Currency, Percent, Link, Date, List, Checkbox).
  • Attribute Description — Optional textual description explaining the purpose of the custom attribute.
  • Attribute Key (required) — Unique identifier key for the custom attribute used internally.
  • Attribute Model — Select whether the custom attribute attaches to Conversations or Contacts.
  • Attribute Values — JSON array specifying allowed values, mainly relevant for attributes of List display type.
  • Regex Pattern — Regular expression pattern to validate input for text attributes.
  • Regex Cue — Validation message displayed if the regex pattern check fails.
  • Default Value — Default value assigned to the custom attribute if no other value is provided.

Output shape

a single JSON object representing the created custom attribute, including its key, display name, type, and other configured properties.

The returned object structure depends on the Mega API response format; error handling applies if creation fails.

Examples

Example 1: Create a text custom attribute for contacts named 'Favorite Color' with validation to accept only letters.

Set 'Attribute Model' to Contact Attribute, 'Attribute Display Name' to 'Favorite Color', 'Attribute Key' to a unique key like 'fav_color', 'Attribute Display Type' to Text, 'Regex Pattern' to a pattern matching only letters, and 'Regex Cue' to an appropriate message.

Links

Discussion