Documentation
Feedback
Guides
VTEX IO Apps

VTEX IO Apps
Functional Apps
Messages GraphQL API
vtex.messages
Version: 1.69.2
Latest version: 1.69.2

This article serves as a comprehensive reference for the GraphQL API provided by the Messages app. This API enables the internationalization of messages in various store contexts, such as Catalog, Intelligent Search, and VTEX IO apps. For more details about how this API is used, see the Overwriting the Messages app article.

Schema overview

Query

classDiagram
  direction LR
  class Languages {
    supported [String!]!
    default String!
  }

  class Translation {
    lang String!
    translation String!
  }

  class MessageListV2 {
    srcLang String!
    groupContext String
    context String
    translations [Translation!]!
  }

  class Query {
    languages Languages!
    translate(args TranslateArgs!) [String]!
    translateWithDependencies(args TranslateWithDependenciesArgs!) [String]!
    userTranslations(args IndexedMessages!) [MessageListV2]!
    listV2(args ListArgsV2!) [MessageListV2!]!
    authorize Boolean!
  }

  Query --> Languages : languages
  MessageListV2 --> Translation : translations
  Query --> MessageListV2 : userTranslations
  Query --> MessageListV2 : listV2

  click Query href "#query"
  click Languages href "#languages"
  click MessageListV2 href "#messagelistv2"
  click Translation href "#translation"
Field(argument)TypeDescription
languagesLanguages!Returns the store's default locale and the list of supported languages. These values are defined in the Default Language and Supported Languages settings in the Messages app settings.
translate[String]!Endpoint that retrieves a list of translated messages from a specific locale in Catalog.
argsTranslateArgs!Input for translation requests.
translateWithDependencies[String]!Retrieves a list of translated messages from a specific locale in a VTEX IO app. The response is a list of MessageListV2, where each element contains a list of messages.
argsTranslateWithDependenciesArgs!Input for translation requests. Similar to TranslateArgs but requires dependency information.
userTranslations[MessageListV2]!Retrieves user translations. The response is a list of MessageListV2, where each element contains a list of messages from a specific source (CMS, an app, etc.).
argsIndexedMessages!Group of messages by their source language.
listV2[MessageListV2!]!Retrieves a subset of all messages stored in VBase. The range argument defines the beginning and the end of the retrieved list. The response is a list of MessageListV2, where each element has a list of messages from a specific source (CMS, an app, etc.).
argsListArgsV2!Argument used for message pagination.
authorizeBoolean!Handles authorization for requests outside IO using a two-factor authentication token. It works with the Two Factor URL app setting.

Mutation

classDiagram
  direction LR
  class Mutation {
    saveV2(args SaveArgsV2!) Boolean!
  }

  click Mutation href "#mutation"
Field(argument)TypeDescription
saveV2Boolean!Creates or updates custom messages for the specified locale. This applies to translations for Catalog, Intelligent Search, and installed apps.
argsSaveArgsV2!Input of messages to be saved.

Schema description

Arguments must be provided by the user. Required fields are marked with an exclamation mark (!).

Languages

FieldTypeDescription
supported[String!]!A list of languages the store supports. Each language is defined by its locale code in ISO 639-1 format. Example: en-US. If the request to the Messages app has a target language that isn't supported, it will translate to the default language, which is defined by Supported Languages in the app settings.
defaultString!The default fallback language for the store, defined by its locale code in ISO 639-1 format. Example: en-US. If the value is *, all languages will be supported. This is defined by Default Language in the app settings.
Query 🔼

MessageListV2

FieldTypeDescription
srcLangString!Locale code of the message list source content in ISO 639-1 format. Example: en-US.
groupContext

String

Groups related translations based on their context.

  • Apps: automaticV2.
  • CMS: CMS.
  • Undefined: null.
contextString

Defines the context for the translation. For example:

  • Catalog: ID of the product/brand/category you want to translate, found in the Admin under Product > Catalog.
  • Apps: The name of the app in which the message is being overwritten.
  • Intelligent Search: intelligentSearchFacets, which defines the context of VTEX Intelligent Search.
translations[Translation!]!List of messages in the context.
Query 🔼
IndexedMessages 🔽

Translation

FieldTypeDescription
langString!Message locale code in ISO 639-1 format. Example: en-US.
translationString!The translated message string.
MessageListV2 🔼

IndexedMessages

FieldTypeDescription
fromString!Source message locale code in ISO 639-1 format. Example: en-US.
messages[MessageInputV2!]!List of messages to check translations. Each item in the list is a message in MessageInputV2 format.
Query 🔼
TranslateArgs 🔽

ListArgsV2

FieldTypeDescription
rangeMessagesRange!Range indicating the first and last messages in the list.
Query 🔼

MessageInputV2

FieldTypeDescription
contentString! Source message string.
contextString

Provides context for the message. For example:

  • Catalog: ID of the product/brand/category you want to check the translation, found in the Admin under Product > Catalog.
  • Apps: The name of the app in which the message has been overwritten.
behaviorBehaviorDefines the translation source. The available options are USER_ONLY, USER_AND_APP, and FULL.
IndexedMessages 🔼

MessageSaveInputV2

FieldTypeDescription
srcLangString!Store's locale default code in ISO 639-1 format. Example: en-US. In the VTEX Intelligent Search context, this variable must be the store's binding default.
srcMessageString!

The source message based on its context:

  • Catalog: Source message string.

  • Apps: The ID of your message string declared in the app's messages folder.

  • Intelligent Search: Source message string. Check the list below for the possible values of this variable and their definitions.

    • Category 1: Department.
    • Category 2: Category.
    • Category 3: Subcategory.
    • Price: Price.
    • Promotion: Promotion.
    • New Release: New release.
    • Location: Location.
    • Brand: Brand.
targetMessageString!
  • Catalog: Translated message string.
  • Apps: Translated message string.
  • Intelligent Search: Translated message string.
groupContext

String

Groups related translations based on their context.

  • Apps: automaticV2.
  • CMS: CMS.
  • Undefined: null.
contextString
  • Catalog: ID of the product/brand/category you want to translate, found in the Admin under Product > Catalog.
  • Apps: The name of the app in which the message is being overwritten.
  • Intelligent Search: intelligentSearchFacets, which defines the context of VTEX Intelligent Search.
SaveArgsV2 🔽

MessagesRange

FieldTypeDescription
fromInt!Position of the first list element.
toInt!Position of the last list element.
ListArgsV2 🔼

SaveArgsV2

FieldTypeDescription
toString!Target locale code (ISO 639-1 format, for example: en-US) for the translation.
messages

[MessageSaveInputV2!]!

List of messages to be translated.
fireEventBooleanIf true, the request triggers an event. Default: false.
Mutation 🔼

TranslateArgs

FieldTypeDescription
indexedByFrom[IndexedMessages!]!List of IndexedMessages. Each item in the list has a locale and a corresponding list of messages.
toString!Target locale code (ISO 639-1 format, for example: en-US) for the translation.
depTreeStringThe dependency tree in the format "[{"id": "{context}"}]". Example: "[{"id": "vtex.store-components@3.x"}]".
encodingEncodingThe encoding format for messages sent to the automatic translation service. The available formats are ICU and HANDLEBARS.
Query 🔼

TranslateWithDependenciesArgs

FieldTypeDescription
indexedByFrom[IndexedMessages!]!List of IndexedMessages. Each item in the list has a locale and a corresponding list of messages.
toString!Target locale code (ISO 639-1 format, for example: en-US) for the translation.
depTreeString!The dependency tree in the format "[{"id": "{context}"}]". Example: "[{"id": "vtex.store-components@3.x"}]".
encodingEncodingThe encoding format for messages sent to the automatic translation service. The available formats are ICU and HANDLEBARS.
Query 🔼

Behavior

ValueDescription
USER_ONLYOnly uses translations defined by users, ignoring app and automatic translations.
USER_AND_APPUses both user-defined and app-defined translations, but ignores automatic translations.
FULLUses all available translation sources.
MessageInputV2 🔼

Encoding

ValueDescription
ICUUse for messages to be encoded in ICU (International Components for Unicode) format through the ICU MessageFormat Parser.
HANDLEBARSUse for messages to be encoded in Handlebars format.
TranslateArgs 🔼
See also
Vtex.messages
VTEX IO Apps
VTEX App Store
VTEX IO Apps