¿Cuál es la syntax correcta para enviar una notificación de FCM a múltiples temas a través de la condición usando node.js?

Estoy intentando enviar una notificación fcm desde mi servidor node.js a dispositivos Android. funciona con un solo tema, pero falla cuando se tienen varios temas.

Nota: Trabajando con un solo tema como,

var topic = 'MaleFemale'; // here i have only one topic var message = { android: { ttl: 5*60*1000, // 5 min in milliseconds priority: 'normal', notification: { title: 'Someone want to chat', body: 'Tap to join chat', icon: 'stock_ticker_update', color: '#2C5AE1' } }, topic: topic }; send.admin.messaging().send(message) .then((response) => { // Response is a message ID string. console.log('Successfully sent message:', response); }) .catch((error) => { console.log('Error sending message:', error); }); 

Nota: falla en múltiples temas como,

 var topic = "'FemaleAny' in topics || 'MaleAny' in topics";//here i have multiple topic var message = { android: { ttl: 5*60*1000, // 5 min in milliseconds priority: 'normal', notification: { title: 'Someone want to chat', body: 'Tap to join chat', icon: 'stock_ticker_update', color: '#2C5AE1' } }, condition: topic }; send.admin.messaging().sendToCondition(message) .then((response) => { // Response is a message ID string. console.log('Successfully sent message:', response); }) .catch((error) => { console.log('Error sending message:', error); }); 

Error:

 throw new error_1.FirebaseMessagingError(error_1.MessagingClientErrorCode.INVALID_RECIPIENT, 'Condition provided to sendToCondition() must be a non-empty string.'); ^ Error: Condition provided to sendToCondition() must be a non-empty string. at FirebaseMessagingError.FirebaseError [as constructor] (/Users/kdblue/Desktop/Android Projects/ChatApp/server/node_modules/firebase-admin/lib/utils/error.js:39:28) at FirebaseMessagingError.PrefixedFirebaseError [as constructor] (/Users/kdblue/Desktop/Android Projects/ChatApp/server/node_modules/firebase-admin/lib/utils/error.js:85:28) at new FirebaseMessagingError (/Users/kdblue/Desktop/Android Projects/ChatApp/server/node_modules/firebase-admin/lib/utils/error.js:241:16) at Messaging.sendToCondition (/Users/kdblue/Desktop/Android Projects/ChatApp/server/node_modules/firebase-admin/lib/messaging/messaging.js:637:19) at manageQueue (/Users/kdblue/Desktop/Android Projects/ChatApp/server/index.js:268:40) at Socket.socket.on (/Users/kdblue/Desktop/Android Projects/ChatApp/server/index.js:25:9) at Socket.emit (events.js:182:13) at /Users/kdblue/Desktop/Android Projects/ChatApp/server/node_modules/socket.io/lib/socket.js:528:12 at process._tickCallback (internal/process/next_tick.js:61:11) 

Lo intenté pero no trabajé para mí:

1) https://firebase.google.com/docs/cloud-messaging/admin/send-messages?authuser=0

2) ¿Cuál es la syntax correcta para enviar Firebase Cloud Messaging (FCM) a múltiples temas a través de una condición?

Es poco raro, estoy dando respuesta a mi pregunta, de todos modos resolví el problema cambiando el método sendToCondition() a send() .

 var condition = "'FemaleAny' in topics || 'MaleAny' in topics"; var message = { android: { ttl: 30*1000, // 30sec in milliseconds priority: 'normal', notification: { title: 'Someone want to chat', body: 'Tap to join chat', icon: 'stock_ticker_update', color: '#2C5AE1', tag: '4' } }, condition: condition }; send.admin.messaging().send(message) .then((response) => { // Response is a message ID string. console.log('Successfully sent message:', response); }) .catch((error) => { console.log('Error sending message:', error); });