Skip to content

Instantly share code, notes, and snippets.

@ilovelili
Last active April 24, 2021 12:19
Show Gist options
  • Save ilovelili/f42f1f825c0817d68806b7abf747d43b to your computer and use it in GitHub Desktop.
Save ilovelili/f42f1f825c0817d68806b7abf747d43b to your computer and use it in GitHub Desktop.
fcm send message
msg := &messaging.Message{
APNS: &messaging.APNSConfig{
Headers: map[string]string{
"apns-priority": "10",
},
Payload: &messaging.APNSPayload{
Aps: &messaging.Aps{
Alert: &messaging.ApsAlert{
Title: category,
Body: body,
},
// Badge: &badge,
},
// question: do I put the payload here?
CustomData: map[string]interface{}{
"type": "mention",
"commentId": "1",
"picture": "https://cdn.woodstock.club/logo.png",
"name": "min",
"comment": "you are cool",
},
},
},
// question: or here?
Data: map[string]string{
"type": "mention",
"commentId": "1",
"picture": "https://cdn.woodstock.club/logo.png",
"name": "min",
"comment": "you are cool",
},
Token: device.DeviceID,
}
_, err := fcmClient.Send(context.Background(), msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment