{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-q/json-schema/amazon-q-create-message-template-request-schema.json",
  "title": "CreateMessageTemplateRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-q-messagetemplates-api-openapi.yml#/components/schemas/CreateMessageTemplateRequest",
  "type": "object",
  "properties": {
    "knowledgeBaseId": {
      "type": "string",
      "description": "The identifier of the knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN."
    },
    "name": {
      "type": "string",
      "description": "The name of the message template."
    },
    "content": {
      "$ref": "#/$defs/MessageTemplateContentProvider"
    },
    "description": {
      "type": "string",
      "description": "The description of the message template."
    },
    "channelSubtype": {
      "type": "string",
      "description": "The channel subtype this message template applies to."
    },
    "language": {
      "type": "string",
      "description": "The language code value for the language in which the quick response is written. The supported language codes include de_DE, en_US, es_ES, fr_FR, id_ID, it_IT, ja_JP, ko_KR, pt_BR, zh_CN, zh_TW"
    },
    "sourceConfiguration": {
      "$ref": "#/$defs/MessageTemplateSourceConfiguration"
    },
    "defaultAttributes": {
      "$ref": "#/$defs/MessageTemplateAttributes"
    },
    "groupingConfiguration": {
      "$ref": "#/$defs/GroupingConfiguration"
    },
    "clientToken": {
      "type": "string",
      "description": "A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs."
    },
    "tags": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "The tags used to organize, track, or control access for this resource."
    }
  },
  "required": [
    "knowledgeBaseId",
    "channelSubtype"
  ],
  "$defs": {
    "AgentAttributes": {
      "type": "object",
      "properties": {
        "firstName": {
          "type": "string",
          "description": "The agent’s first name as entered in their Amazon Connect user account."
        },
        "lastName": {
          "type": "string",
          "description": "The agent’s last name as entered in their Amazon Connect user account."
        }
      }
    },
    "CustomerProfileAttributes": {
      "type": "object",
      "properties": {
        "profileId": {
          "type": "string",
          "description": "The unique identifier of a customer profile."
        },
        "profileARN": {
          "type": "string",
          "description": "The ARN of a customer profile."
        },
        "firstName": {
          "type": "string",
          "description": "The customer's first name."
        },
        "middleName": {
          "type": "string",
          "description": "The customer's middle name."
        },
        "lastName": {
          "type": "string",
          "description": "The customer's last name."
        },
        "accountNumber": {
          "type": "string",
          "description": "A unique account number that you have given to the customer."
        },
        "emailAddress": {
          "type": "string",
          "description": "The customer's email address, which has not been specified as a personal or business address."
        },
        "phoneNumber": {
          "type": "string",
          "description": "The customer's phone number, which has not been specified as a mobile, home, or business number."
        },
        "additionalInformation": {
          "type": "string",
          "description": "Any additional information relevant to the customer's profile."
        },
        "partyType": {
          "type": "string",
          "description": "The customer's party type."
        },
        "businessName": {
          "type": "string",
          "description": "The name of the customer's business."
        },
        "birthDate": {
          "type": "string",
          "description": "The customer's birth date."
        },
        "gender": {
          "type": "string",
          "description": "The customer's gender."
        },
        "mobilePhoneNumber": {
          "type": "string",
          "description": "The customer's mobile phone number."
        },
        "homePhoneNumber": {
          "type": "string",
          "description": "The customer's mobile phone number."
        },
        "businessPhoneNumber": {
          "type": "string",
          "description": "The customer's business phone number."
        },
        "businessEmailAddress": {
          "type": "string",
          "description": "The customer's business email address."
        },
        "address1": {
          "type": "string",
          "description": "The first line of a customer address."
        },
        "address2": {
          "type": "string",
          "description": "The second line of a customer address."
        },
        "address3": {
          "type": "string",
          "description": "The third line of a customer address."
        },
        "address4": {
          "type": "string",
          "description": "The fourth line of a customer address."
        },
        "city": {
          "type": "string",
          "description": "The city in which a customer lives."
        },
        "county": {
          "type": "string",
          "description": "The county in which a customer lives."
        },
        "country": {
          "type": "string",
          "description": "The country in which a customer lives."
        },
        "postalCode": {
          "type": "string",
          "description": "The postal code of a customer address."
        },
        "province": {
          "type": "string",
          "description": "The province in which a customer lives."
        },
        "state": {
          "type": "string",
          "description": "The state in which a customer lives."
        },
        "shippingAddress1": {
          "type": "string",
          "description": "The first line of a customer’s shipping address."
        },
        "shippingAddress2": {
          "type": "string",
          "description": "The second line of a customer’s shipping address."
        },
        "shippingAddress3": {
          "type": "string",
          "description": "The third line of a customer’s shipping address."
        },
        "shippingAddress4": {
          "type": "string",
          "description": "The fourth line of a customer’s shipping address."
        },
        "shippingCity": {
          "type": "string",
          "description": "The city of a customer’s shipping address."
        },
        "shippingCounty": {
          "type": "string",
          "description": "The county of a customer’s shipping address."
        },
        "shippingCountry": {
          "type": "string",
          "description": "The country of a customer’s shipping address."
        },
        "shippingPostalCode": {
          "type": "string",
          "description": "The postal code of a customer’s shipping address."
        },
        "shippingProvince": {
          "type": "string",
          "description": "The province of a customer’s shipping address."
        },
        "shippingState": {
          "type": "string",
          "description": "The state of a customer’s shipping address."
        },
        "mailingAddress1": {
          "type": "string",
          "description": "The first line of a customer’s mailing address."
        },
        "mailingAddress2": {
          "type": "string",
          "description": "The second line of a customer’s mailing address."
        },
        "mailingAddress3": {
          "type": "string",
          "description": "The third line of a customer’s mailing address."
        },
        "mailingAddress4": {
          "type": "string",
          "description": "The fourth line of a customer’s mailing address."
        },
        "mailingCity": {
          "type": "string",
          "description": "The city of a customer’s mailing address."
        },
        "mailingCounty": {
          "type": "string",
          "description": "The county of a customer’s mailing address."
        },
        "mailingCountry": {
          "type": "string",
          "description": "The country of a customer’s mailing address."
        },
        "mailingPostalCode": {
          "type": "string",
          "description": "The postal code of a customer’s mailing address."
        },
        "mailingProvince": {
          "type": "string",
          "description": "The province of a customer’s mailing address."
        },
        "mailingState": {
          "type": "string",
          "description": "The state of a customer’s mailing address."
        },
        "billingAddress1": {
          "type": "string",
          "description": "The first line of a customer’s billing address."
        },
        "billingAddress2": {
          "type": "string",
          "description": "The second line of a customer’s billing address."
        },
        "billingAddress3": {
          "type": "string",
          "description": "The third line of a customer’s billing address."
        },
        "billingAddress4": {
          "type": "string",
          "description": "The fourth line of a customer’s billing address."
        },
        "billingCity": {
          "type": "string",
          "description": "The city of a customer’s billing address."
        },
        "billingCounty": {
          "type": "string",
          "description": "The county of a customer’s billing address."
        },
        "billingCountry": {
          "type": "string",
          "description": "The country of a customer’s billing address."
        },
        "billingPostalCode": {
          "type": "string",
          "description": "The postal code of a customer’s billing address."
        },
        "billingProvince": {
          "type": "string",
          "description": "The province of a customer’s billing address."
        },
        "billingState": {
          "type": "string",
          "description": "The state of a customer’s billing address."
        },
        "custom": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "The custom attributes in customer profile attributes."
        }
      }
    },
    "EmailHeader": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the email header."
        },
        "value": {
          "type": "string",
          "description": "The value of the email header."
        }
      }
    },
    "EmailMessageTemplateContent": {
      "type": "object",
      "properties": {
        "subject": {
          "type": "string",
          "description": "The subject line, or title, to use in email messages."
        },
        "body": {
          "$ref": "#/$defs/EmailMessageTemplateContentBody"
        },
        "headers": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/EmailHeader"
          },
          "description": "The email headers to include in email messages."
        }
      }
    },
    "EmailMessageTemplateContentBody": {
      "type": "object",
      "properties": {
        "plainText": {
          "$ref": "#/$defs/MessageTemplateBodyContentProvider"
        },
        "html": {
          "$ref": "#/$defs/MessageTemplateBodyContentProvider"
        }
      }
    },
    "GroupingConfiguration": {
      "type": "object",
      "properties": {
        "criteria": {
          "type": "string",
          "description": "The criteria used for grouping Amazon Q in Connect users. The following is the list of supported criteria values. RoutingProfileArn: Grouping the users by their Amazon Connect routing profile ARN. User should have SearchRoutingProfile and DescribeRoutingProfile permissions when setting criteria to this value."
        },
        "values": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The list of values that define different groups of Amazon Q in Connect users. When setting criteria to RoutingProfileArn, you need to provide a list of ARNs of Connect Customer routing profiles as values of this parameter."
        }
      }
    },
    "MessageTemplateAttributes": {
      "type": "object",
      "properties": {
        "systemAttributes": {
          "$ref": "#/$defs/SystemAttributes"
        },
        "agentAttributes": {
          "$ref": "#/$defs/AgentAttributes"
        },
        "customerProfileAttributes": {
          "$ref": "#/$defs/CustomerProfileAttributes"
        },
        "customAttributes": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "The custom attributes that are used with the message template."
        }
      }
    },
    "MessageTemplateBodyContentProvider": {
      "type": "object",
      "properties": {
        "content": {
          "type": "string",
          "description": "The content of the message template."
        }
      },
      "description": "Exactly one member is set."
    },
    "MessageTemplateContentProvider": {
      "type": "object",
      "properties": {
        "email": {
          "$ref": "#/$defs/EmailMessageTemplateContent"
        },
        "sms": {
          "$ref": "#/$defs/SMSMessageTemplateContent"
        },
        "whatsApp": {
          "$ref": "#/$defs/WhatsAppMessageTemplateContent"
        },
        "push": {
          "$ref": "#/$defs/PushMessageTemplateContent"
        }
      },
      "description": "Exactly one member is set."
    },
    "MessageTemplateSourceConfiguration": {
      "type": "object",
      "properties": {
        "whatsApp": {
          "$ref": "#/$defs/WhatsAppMessageTemplateSourceConfiguration"
        }
      },
      "description": "Exactly one member is set."
    },
    "PushADMMessageTemplateContent": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "description": "The title to use in a push notification that's based on the message template. This title appears above the notification message on a recipient's device."
        },
        "body": {
          "$ref": "#/$defs/MessageTemplateBodyContentProvider"
        },
        "action": {
          "type": "string",
          "description": "The action to occur if a recipient taps a push notification that is based on the message template. Valid values are: OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action. DEEP_LINK - Your app opens and displays a designated user interface in the app. This action uses the deep-linking features of the Android platform. URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify."
        },
        "sound": {
          "type": "string",
          "description": "The sound to play when a recipient receives a push notification that's based on the message template. You can use the default stream or specify the file name of a sound resource that's bundled in your app. On an Android platform, the sound file must reside in /res/raw/."
        },
        "url": {
          "type": "string",
          "description": "The URL to open in a recipient's default mobile browser, if a recipient taps a push notification that's based on the message template and the value of the action property is URL."
        },
        "imageUrl": {
          "type": "string",
          "description": "The URL of an image to display in a push notification that's based on the message template."
        },
        "imageIconUrl": {
          "type": "string",
          "description": "The URL of the large icon image to display in the content view of a push notification that's based on the message template."
        },
        "smallImageIconUrl": {
          "type": "string",
          "description": "The URL of the small icon image to display in the status bar and the content view of a push notification that's based on the message template."
        },
        "rawContent": {
          "$ref": "#/$defs/MessageTemplateBodyContentProvider"
        }
      }
    },
    "PushAPNSMessageTemplateContent": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "description": "The title to use in a push notification that's based on the message template. This title appears above the notification message on a recipient's device."
        },
        "body": {
          "$ref": "#/$defs/MessageTemplateBodyContentProvider"
        },
        "action": {
          "type": "string",
          "description": "The action to occur if a recipient taps a push notification that is based on the message template. Valid values are: OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action. DEEP_LINK - Your app opens and displays a designated user interface in the app. This action uses the deep-linking features of the iOS platform. URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify."
        },
        "sound": {
          "type": "string",
          "description": "The key for the sound to play when the recipient receives a push notification that's based on the message template. The value for this key is the name of a sound file in your app's main bundle or the Library/Sounds folder in your app's data container. If the sound file can't be found or you specify default for the value, the system plays the default alert sound."
        },
        "url": {
          "type": "string",
          "description": "The URL to open in a recipient's default mobile browser, if a recipient taps a push notification that's based on the message template and the value of the action property is URL."
        },
        "mediaUrl": {
          "type": "string",
          "description": "The URL of an image or video to display in push notifications that are based on the message template."
        },
        "rawContent": {
          "$ref": "#/$defs/MessageTemplateBodyContentProvider"
        }
      }
    },
    "PushBaiduMessageTemplateContent": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "description": "The title to use in a push notification that's based on the message template. This title appears above the notification message on a recipient's device."
        },
        "body": {
          "$ref": "#/$defs/MessageTemplateBodyContentProvider"
        },
        "action": {
          "type": "string",
          "description": "The action to occur if a recipient taps a push notification that is based on the message template. Valid values are: OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action. DEEP_LINK - Your app opens and displays a designated user interface in the app. This action uses the deep-linking features of the Android platform. URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify."
        },
        "sound": {
          "type": "string",
          "description": "The sound to play when a recipient receives a push notification that's based on the message template. You can use the default stream or specify the file name of a sound resource that's bundled in your app. On an Android platform, the sound file must reside in /res/raw/."
        },
        "url": {
          "type": "string",
          "description": "The URL to open in a recipient's default mobile browser, if a recipient taps a push notification that's based on the message template and the value of the action property is URL."
        },
        "imageUrl": {
          "type": "string",
          "description": "The URL of an image to display in a push notification that's based on the message template."
        },
        "imageIconUrl": {
          "type": "string",
          "description": "The URL of the large icon image to display in the content view of a push notification that's based on the message template."
        },
        "smallImageIconUrl": {
          "type": "string",
          "description": "The URL of the small icon image to display in the status bar and the content view of a push notification that's based on the message template."
        },
        "rawContent": {
          "$ref": "#/$defs/MessageTemplateBodyContentProvider"
        }
      }
    },
    "PushFCMMessageTemplateContent": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "description": "The title to use in a push notification that's based on the message template. This title appears above the notification message on a recipient's device."
        },
        "body": {
          "$ref": "#/$defs/MessageTemplateBodyContentProvider"
        },
        "action": {
          "type": "string",
          "description": "The action to occur if a recipient taps a push notification that is based on the message template. Valid values are: OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action. DEEP_LINK - Your app opens and displays a designated user interface in the app. This action uses the deep-linking features of the Android platform. URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify."
        },
        "sound": {
          "type": "string",
          "description": "The sound to play when a recipient receives a push notification that's based on the message template. You can use the default stream or specify the file name of a sound resource that's bundled in your app. On an Android platform, the sound file must reside in /res/raw/."
        },
        "url": {
          "type": "string",
          "description": "The URL to open in a recipient's default mobile browser, if a recipient taps a push notification that's based on the message template and the value of the action property is URL."
        },
        "imageUrl": {
          "type": "string",
          "description": "The URL of an image to display in a push notification that's based on the message template."
        },
        "imageIconUrl": {
          "type": "string",
          "description": "The URL of the large icon image to display in the content view of a push notification that's based on the message template."
        },
        "smallImageIconUrl": {
          "type": "string",
          "description": "The URL of the small icon image to display in the status bar and the content view of a push notification that's based on the message template."
        },
        "rawContent": {
          "$ref": "#/$defs/MessageTemplateBodyContentProvider"
        }
      }
    },
    "PushMessageTemplateContent": {
      "type": "object",
      "properties": {
        "adm": {
          "$ref": "#/$defs/PushADMMessageTemplateContent"
        },
        "apns": {
          "$ref": "#/$defs/PushAPNSMessageTemplateContent"
        },
        "fcm": {
          "$ref": "#/$defs/PushFCMMessageTemplateContent"
        },
        "baidu": {
          "$ref": "#/$defs/PushBaiduMessageTemplateContent"
        }
      }
    },
    "SMSMessageTemplateContent": {
      "type": "object",
      "properties": {
        "body": {
          "$ref": "#/$defs/SMSMessageTemplateContentBody"
        }
      }
    },
    "SMSMessageTemplateContentBody": {
      "type": "object",
      "properties": {
        "plainText": {
          "$ref": "#/$defs/MessageTemplateBodyContentProvider"
        }
      }
    },
    "SystemAttributes": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the task."
        },
        "customerEndpoint": {
          "$ref": "#/$defs/SystemEndpointAttributes"
        },
        "systemEndpoint": {
          "$ref": "#/$defs/SystemEndpointAttributes"
        }
      }
    },
    "SystemEndpointAttributes": {
      "type": "object",
      "properties": {
        "address": {
          "type": "string",
          "description": "The customer's phone number if used with customerEndpoint, or the number the customer dialed to call your contact center if used with systemEndpoint."
        }
      }
    },
    "WhatsAppMessageTemplateContent": {
      "type": "object",
      "properties": {
        "data": {
          "type": "string",
          "description": "The data."
        }
      }
    },
    "WhatsAppMessageTemplateSourceConfiguration": {
      "type": "object",
      "properties": {
        "businessAccountId": {
          "type": "string",
          "description": "The ID of the End User Messaging WhatsApp Business Account to associate with this template."
        },
        "templateId": {
          "type": "string",
          "description": "The WhatsApp template ID."
        },
        "components": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The list of component mapping from WhatsApp template parameters to Message Template attributes."
        }
      },
      "required": [
        "businessAccountId",
        "templateId"
      ]
    }
  }
}