Hey there,
I went down a rabbit hole of SDK threads, documentation, and videos but I am struggling to integrate a NPM SDK on WeWeb. Here’s what I have done so far:
- The package: @moneykit/connect - npm
- I read this thread to import the MoneyKit module Cannot Use Import Statement - #19 by Jonny
- I didn’t find any
require
or other issues in the SDK discussed in @raydeck 's videos
Which landed me with this setup that doesn’t throw an error but also doesn’t launch the popup that it should (the popup is not being blocked either).
- I installed the NPM plugin and configured the @moneykit/connect package
- I created an “on app load” workflow to run the action code from this video https://weweb-embed.statechange.ai/ to install on the editor
window["scp-loading-ae4df260-c2c6-4b7c-bc98-36d4b87b6b51"] = true;
let doc;
/* Adding script from null */
doc = document.createElement('script');
doc.innerHTML = `npm install @moneykit/connect`;
document.body.appendChild(doc);
}
- I added a button to trigger this custom JS from the SDK documentation. linkSessionToken is generated from the server but for testing, I hardcoded it.
const moneykit = new MoneyKitModule.default(); // Use default if MoneyKit is exported as default
moneykit.link(
linkSessionToken,
(exchangeableToken, institution) => {
// onLinkSuccess
console.log("Link created successfully", exchangeableToken, institution);
},
(error) => {
// onLinkExit
console.log(
"Connect closed without creating a link. Error will be provided if one occurred."
);
},
(event) => {
// onLinkEvent
console.log("Link event occurred: ", JSON.stringify(event));
}
);
});
- The WeWeb console says workflow succeeded but nothing happens on the frontend and my webhook listener doesn’t register any events from the SDK vendor, so I’m pretty sure I implemented it incorrectly.