Skip to content

Instantly share code, notes, and snippets.

@antonkrasov
Created December 17, 2020 04:38
Show Gist options
  • Save antonkrasov/03b60c1bea4a26137622162ac9f839bd to your computer and use it in GitHub Desktop.
Save antonkrasov/03b60c1bea4a26137622162ac9f839bd to your computer and use it in GitHub Desktop.
tmp.js
try {
const pushTokenDoc = await db.collection(`push_tokens/${userRef.id}`).doc();
const token = pushTokenDoc.data().token;
const title = 'TITLE';
const message = 'MESSAGE';
const payload = {
notification: {
title: title,
body: message
},
priority: 'high',
data: {
click_action: 'FLUTTER_NOTIFICATION_CLICK',
receiver: 'intercom_sdk',
intercom_push_type: 'push_only',
title: title,
message: message
}
};
admin.messaging().sendToDevice(token, payload)
} catch (ex) {
console.log(ex)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment