Complete the code to subscribe a device to a topic.
firebase.messaging().subscribeToTopic(token, [1]);The subscribeToTopic method requires the topic name as a string. Here, 'news' is the topic.
Complete the code to send a message to a topic.
admin.messaging().send({ topic: [1], notification: { title: 'Hello', body: 'World' } });The topic field must be the topic name string, such as 'news', to send messages to all subscribers.
Fix the error in the code to unsubscribe from a topic.
firebase.messaging().[1](token, 'news');
To unsubscribe a device from a topic, use unsubscribeFromTopic method.
Fill both blanks to create a message payload for topic messaging with a data payload.
const message = { topic: [1], data: { [2]: 'value' } };The topic is set to 'sports' and the data key is 'score' with a value.
Fill all three blanks to send a notification message with a topic and a condition.
const message = { [1]: 'weather', notification: { [2]: 'Alert', [3]: 'Rain expected' }, condition: "'weather' in topics || 'news' in topics" };The message uses topic to specify the topic, and title and body for notification content.
