Closed pascalito007 closed 5 months ago
Hello, @pascalito007 and sorry to hear your running into this. Can you share the frontend code that is calling both syncMessages()
as well as dispatchEvent
? And just to confirm, are you initializing In-App Messaging in your App.js
file right after you call Amplify.configure()
?
Thanks and looking forward to helping you get unblocked!
@cwomack thanks for your response.
Please find below sample code
in my App.js
// At top level
import { useEffect } from "react";
import amplifyconfig from './src/amplifyconfiguration.json';
import { initializeInAppMessaging } from 'aws-amplify/in-app-messaging';
import { syncMessages } from 'aws-amplify/in-app-messaging';
Amplify.configure(amplifyconfig);
initializeInAppMessaging();
export default App = () => {
useEffect(() => {
syncMessages().then((response) => {
console.log("syncMessages:", response);
});
}, []);
}
The console.log
response
value is always undefined
even if I have created a campaign in pinpoint
In a component Home.js
When I run below code nothing happen
dispatchEvent({name: "WelcomePromo"});
@pascalito007, do you see your campaigns getting synched in async storage by chance? The syncMessages()
API will not return campaigns when making the call. It will only sync the campaign to the async storage.
As for the UI not displaying, we might need to know more about your setup to understand what's happening there. It doesn't look like you're using the Amplify UI Connected Component for In-App Messaging, but that may be something to consider.
Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue.
Thank you!
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Analytics, Not applicable
Amplify Version
v6
Amplify Categories
notifications
Backend
None
Environment information
Describe the bug
I have added and configured In-App-Messaging in my react native expo project but when using
await syncMessages();
in myApp.js
I always gotundefined
When I dispatch event with
await dispatchEvent({ name: "WelcomePromo" });
I can see that Message Delivered count is increasing in the Pinpoint console but I cant see the In-App-MessageExpected behavior
syncMessages should sync messages locally in order to
dispatchEvent
to show in-app-messageReproduction steps
Code Snippet
Log output
aws-exports.js
No response
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