Closed ykethan closed 6 months ago
HI @ykethan thank you for opening this issue. The issue looks like you have scoped the wrong configuration for InApp messaging and set it up under PushNotifications, which is only supported in ReactNative.
Update you config to the following and let me know if it works
Notifications: {
InAppMessaging: {
Pinpoint: {
appId: config.Analytics.AWSPinpoint.appId,
region: "us-east-1",
},
},
},
Closing out this issue after discussing separately with @ykethan - issue was due to missing start and end time on the Campaign
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Analytics
Amplify Version
v6
Amplify Categories
analytics, notifications
Backend
None
Environment information
Describe the bug
Created an pinpoint resource with Amplify Gen 2 with a nextjs app
in
_app.tsx
index.tsx
on running the app do see Analytics event in the network tab but the In-App messaging doesnt seem to do anything. No network errors.
but the app does throw error
which is unexpected as
Amplify.getConfig()
does show the resourcesExpected behavior
n/a
Reproduction steps
const mySegment = new CfnSegment(apigateway, "Segment", { applicationId: pinpoint.ref, name: "mySegment", });
new CfnCampaign(apigateway, "MyCampaign", { applicationId: pinpoint.ref, name: "MyCampaign", segmentId: mySegment.attrSegmentId, schedule: { startTime: "IMMEDIATE", frequency: "IN_APP_EVENT", eventFilter: { dimensions: { eventType: { dimensionType: "INCLUSIVE", values: ["PURCHASE"], }, }, filterType: "ENDPOINT", }, },
messageConfiguration: { inAppMessage: { layout: "TOP_BANNER", content: [ { // Define the content of the in-app message bodyConfig: { alignment: "CENTER", body: "This is an example in-app message.", textColor: "#FFFFFF", }, backgroundColor: "#000000", headerConfig: { alignment: "CENTER", header: "Welcome!", textColor: "#FFFFFF", }, // Optionally, define buttons, images, etc. }, ], }, }, });
const pinpointPolicy = new Policy(apigateway, "PinpointPolicy", { policyName: "PinpointPolicy", statements: [ new PolicyStatement({ actions: ["mobiletargeting:UpdateEndpoint", "mobiletargeting:PutEvents"], resources: ["*"], }), ], });
bac.auth.resources.authenticatedUserIamRole.attachInlinePolicy(pinpointPolicy); bac.auth.resources.unauthenticatedUserIamRole.attachInlinePolicy( pinpointPolicy );
bac.addOutput({ Analytics: { AWSPinpoint: { appId: pinpoint.ref, region: "us-east-1", }, }, Notifications: { InAppMessaging: { AWSPinpoint: { appId: pinpoint.ref, region: "us-east-1", }, }, }, });
Log output
aws-exports.js
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response