UpdateInAppTemplateCommand

Updates an existing message template for messages sent through the in-app message channel.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { PinpointClient, UpdateInAppTemplateCommand } from "@aws-sdk/client-pinpoint"; // ES Modules import
// const { PinpointClient, UpdateInAppTemplateCommand } = require("@aws-sdk/client-pinpoint"); // CommonJS import
const client = new PinpointClient(config);
const input = { // UpdateInAppTemplateRequest
  CreateNewVersion: true || false,
  InAppTemplateRequest: { // InAppTemplateRequest
    Content: [ // ListOfInAppMessageContent
      { // InAppMessageContent
        BackgroundColor: "STRING_VALUE",
        BodyConfig: { // InAppMessageBodyConfig
          Alignment: "LEFT" || "CENTER" || "RIGHT", // required
          Body: "STRING_VALUE", // required
          TextColor: "STRING_VALUE", // required
        },
        HeaderConfig: { // InAppMessageHeaderConfig
          Alignment: "LEFT" || "CENTER" || "RIGHT", // required
          Header: "STRING_VALUE", // required
          TextColor: "STRING_VALUE", // required
        },
        ImageUrl: "STRING_VALUE",
        PrimaryBtn: { // InAppMessageButton
          Android: { // OverrideButtonConfiguration
            ButtonAction: "LINK" || "DEEP_LINK" || "CLOSE", // required
            Link: "STRING_VALUE",
          },
          DefaultConfig: { // DefaultButtonConfiguration
            BackgroundColor: "STRING_VALUE",
            BorderRadius: Number("int"),
            ButtonAction: "LINK" || "DEEP_LINK" || "CLOSE", // required
            Link: "STRING_VALUE",
            Text: "STRING_VALUE", // required
            TextColor: "STRING_VALUE",
          },
          IOS: {
            ButtonAction: "LINK" || "DEEP_LINK" || "CLOSE", // required
            Link: "STRING_VALUE",
          },
          Web: {
            ButtonAction: "LINK" || "DEEP_LINK" || "CLOSE", // required
            Link: "STRING_VALUE",
          },
        },
        SecondaryBtn: {
          Android: {
            ButtonAction: "LINK" || "DEEP_LINK" || "CLOSE", // required
            Link: "STRING_VALUE",
          },
          DefaultConfig: {
            BackgroundColor: "STRING_VALUE",
            BorderRadius: Number("int"),
            ButtonAction: "LINK" || "DEEP_LINK" || "CLOSE", // required
            Link: "STRING_VALUE",
            Text: "STRING_VALUE", // required
            TextColor: "STRING_VALUE",
          },
          IOS: {
            ButtonAction: "LINK" || "DEEP_LINK" || "CLOSE", // required
            Link: "STRING_VALUE",
          },
          Web: "<OverrideButtonConfiguration>",
        },
      },
    ],
    CustomConfig: { // MapOf__string
      "<keys>": "STRING_VALUE",
    },
    Layout: "BOTTOM_BANNER" || "TOP_BANNER" || "OVERLAYS" || "MOBILE_FEED" || "MIDDLE_BANNER" || "CAROUSEL",
    tags: {
      "<keys>": "STRING_VALUE",
    },
    TemplateDescription: "STRING_VALUE",
  },
  TemplateName: "STRING_VALUE", // required
  Version: "STRING_VALUE",
};
const command = new UpdateInAppTemplateCommand(input);
const response = await client.send(command);
// { // UpdateInAppTemplateResponse
//   MessageBody: { // MessageBody
//     Message: "STRING_VALUE",
//     RequestID: "STRING_VALUE",
//   },
// };

UpdateInAppTemplateCommand Input

See UpdateInAppTemplateCommandInput for more details

Parameter
Type
Description
InAppTemplateRequest
Required
InAppTemplateRequest | undefined

InApp Template Request.

TemplateName
Required
string | undefined

The name of the message template. A template name must start with an alphanumeric character and can contain a maximum of 128 characters. The characters can be alphanumeric characters, underscores (_), or hyphens (-). Template names are case sensitive.

CreateNewVersion
boolean | undefined

Specifies whether to save the updates as a new version of the message template. Valid values are: true, save the updates as a new version; and, false, save the updates to (overwrite) the latest existing version of the template.

If you don't specify a value for this parameter, Amazon Pinpoint saves the updates to (overwrites) the latest existing version of the template. If you specify a value of true for this parameter, don't specify a value for the version parameter. Otherwise, an error will occur.

Version
string | undefined

The unique identifier for the version of the message template to update, retrieve information about, or delete. To retrieve identifiers and other information for all the versions of a template, use the Template Versions resource.

If specified, this value must match the identifier for an existing template version. If specified for an update operation, this value must match the identifier for the latest existing version of the template. This restriction helps ensure that race conditions don't occur.

If you don't specify a value for this parameter, Amazon Pinpoint does the following:

  • For a get operation, retrieves information about the active version of the template.

  • For an update operation, saves the updates to (overwrites) the latest existing version of the template, if the create-new-version parameter isn't used or is set to false.

  • For a delete operation, deletes the template, including all versions of the template.

UpdateInAppTemplateCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
MessageBody
Required
MessageBody | undefined

Provides information about an API request or response.

Throws

Name
Fault
Details
BadRequestException
client

Provides information about an API request or response.

ForbiddenException
client

Provides information about an API request or response.

InternalServerErrorException
server

Provides information about an API request or response.

MethodNotAllowedException
client

Provides information about an API request or response.

NotFoundException
client

Provides information about an API request or response.

PayloadTooLargeException
client

Provides information about an API request or response.

TooManyRequestsException
client

Provides information about an API request or response.

PinpointServiceException
Base exception class for all service exceptions from Pinpoint service.