Send push from js timer

Hello,
I try to send a push from my timer with JS code. I have this for the push Request

const templateName = 'orderChatTeamTemplate';
      const templateValues = {
        channelName: 'orderStatusProvider',
        message: message,
        userId: user.userId,
        // Utilisateur qui reçoit la notification
        linkedClientId: user.userId,
        linkedProviderId: provider.id,
        eventId: order.id,
        orderId: order.id,
        isForClient: false,
        senderName: '',
        // Si nécessaire, tu peux spécifier un nom ici
        channelId: 'ORDER_CHANNEL' // Assure-toi que ce channelId est correct
      };

      console.log('Before push request 4');

      // Envoyer la notification avec le template
      Backendless.Messaging.pushWithTemplate(templateName, templateValues)
      .then(function(messageStatus) {
        console.log(`Push notification sent successfully for Order ID: ${order.objectId} to User ID: ${linkedClient.userId}`);
      })
      .catch(function(error) {
        console.error(`Error sending push notification for Order ID ${order.objectId}:`, error);
      });

I see the console log with “Before push request 4” but I didn’t see the
console.log(Push notification sent successfully for Order ID: ${order.objectId} to User ID: ${linkedClient.userId});

and I don’t receive the push. But I can’t see why.

The templates values are ok and I send a push to the userId.

My device token is well registered.

Is it possible to debug this situation?

Thanks you

Hello @Indevers

Do you see “Error sending push notification…” after the “Before push request 4” log? Do you see any error in after the “Before push request 4” log?

Hello @viktor.liablin no I didn’t see anymore after the console log with “Before push request 4”

Hi @Indevers,
Could you try the following approach to catch errors? It worked for me and displayed the error in case of failure or the result if successful.

async execute(req){
...

const response = await Backendless.Messaging.pushWithTemplate(...)

console.log('response', response)

}

Regards,
Sergey