Hey !
I tried this code, but, I don’t have any sign that it worked, no log in the terminal, nothing.
And I don’t know why…
I checked the code from this post, and the one from the Strapi website, and modified it for my project : Learn How to Integrate Push Notifications Into Your Applications Using Strapi v4 and Firebase Cloud Messaging [CTRL-F /src/api/like/controllers/like.js]
My code look like this :
// src/api/news/controllers/news.js
'use strict';
/**
* news controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::news.news', ({ strapi }) => ({
async create() {
try {
await strapi.services.notifications.sendMessageToDevices(tokens, title, description, data);
} catch(err) {
strapi.log.error('Notifications/sendMessageToDevices', err);
}
}
}));
I would like to recieve notifications, if any “News” is created.
If anyone have a solution, it would be great, thanks !