Author message templates
Amplify provisions the delivery path for your notifications, but not the message content. The text your users receive comes from a push message template stored in an Amazon Q in Connect knowledge base.
Name the template to match your journey
A push template's name is the only way Amplify links it to a journey: give the template the exact same name as the custom action block in your Amazon Connect journey.
Find your knowledge base ID
In create mode, defineNotifications provisions an empty MESSAGE_TEMPLATES knowledge base and associates it with your Amazon Connect instance through the Q_MESSAGE_TEMPLATES integration. In attach mode, associate a MESSAGE_TEMPLATES knowledge base with your existing Connect instance yourself so this lookup resolves.
Either way, look up the knowledge base ID with the AWS CLI:
aws connect list-integration-associations \ --instance-id <INSTANCE_ID> \ --integration-type Q_MESSAGE_TEMPLATESThe knowledge base ID is the last segment of the returned IntegrationArn, which ends in knowledge-base/<KB_ID>.
Create the message template
Create the template with qconnect create-message-template, using the same name you will give the journey's custom action block:
aws qconnect create-message-template \ --knowledge-base-id <KB_ID> \ --name 'Push Notification' \ --channel-subtype PUSH \ --content '{"push":{"apns":{"title":"Hello {{Attributes.firstName}}","body":{"content":"Your order shipped."}},"fcm":{"title":"Hello {{Attributes.firstName}}","body":{"content":"Your order shipped."}}}}'Per-platform content maps to channels as push.apns (Apple Push Notification service, including the sandbox channel) and push.fcm (Firebase Cloud Messaging). A platform entry needs both a title and a body to be used; a platform you leave out falls back to default copy for that platform.
Publish a version after every copy change:
aws qconnect create-message-template-version \ --knowledge-base-id <KB_ID> \ --message-template-id <TEMPLATE_ID>Personalize the message
Templates support {{Attributes.<key>}} variables, which resolve to the target Customer Profile's fields, including custom attributes set on the profile:
Hello {{Attributes.firstName}}, your order is on the way.A variable with no matching profile value stays literal in the rendered copy, so use variables only for fields you populate consistently, and prefer copy that reads correctly when a value is absent.
See the Amazon Q in Connect message template API reference for the full content schema.
Add the custom action to your journey
Building the journey itself is done in the Amazon Connect console; only template authoring is CLI-only:
- In the Amazon Connect console, navigate to Journeys and open or create a journey.
- Add a custom action block and point it at the push-delivery Lambda function that Amplify deployed.
- Set the block name to the exact
--namevalue you gave the template above, including capitalization. - Publish the journey.