Hi guys, I know very little about programming, I follow the instruction to use Pusher SDK in cloud code, but there was a problem. Can someone help me?
here is my code:
$ yarn add @pusher/push-notifications-server
const PushNotifications = require('@pusher/push-notifications-server');
let pushNotifications = new PushNotifications({
instanceId: 'aaaaaaaaaaaaaaaaaaaaaaaaa',
secretKey: 'aaaaaaaaaaaaaaaaaaaaaaaaa'
});
module.exports = async function (event) {
if (event.type === 'near') {
pushNotifications.publishToInterests(['proximity'], {
fcm: {
notification: {
title: 'proximity',
body: 'near'
}
}
}).then((publishResponse) => {
console.log('Just published:', publishResponse.publishId);
}).catch((error) => {
console.log('Error:', error);
});
}
};