Reputation: 2010
i'm using Firebase console to send a notification to my phone, the notification is successfully delivered to my phone, but i want to know, What is the Character Limit for Message text in Firebase console based notification?
Upvotes: 18
Views: 32496
Reputation: 4138
I'm able to send 4506 character string using API:
admin
.messaging()
.send({
token: fcmRegistrationToken,
data: {
"": "a".repeat(4506)
},
})
.then((response) => {
console.log("Successfully sent message:", response);
})
.catch((error) => {
console.log("Error sending message:", error);
});
Despite docs saying that 4096 is the limit: https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages:~:text=Maximum%20payload%20for%20both%20message%20types%20is%204096%20bytes
(probably still don't use 4506 in production since it's not documented - it can stop working at any point, I'll probably be using 4000 to leave some margin for error)
Upvotes: 0
Reputation: 149
Official docks now mention 1024 for the console and 4KB for the API
Notification messages contain a predefined set of user-visible keys. Data messages, by contrast, contain only your user-defined custom key-value pairs. Notification messages can contain an optional data payload. Maximum payload for both message types is 4000 bytes, except when sending messages from the Firebase console, which enforces a 1024 character limit.
https://firebase.google.com/docs/cloud-messaging/concept-options#notifications
Upvotes: 0
Reputation: 1647
Firebase uses GCM for message transport. Based on the following references
Anyway if we are considering a 2KB payload size. it will come around 2000 characters.
remember to keep the message size low as much as possible.
UPDATE
The console will allow maximum of 1000 characters
Upvotes: 25
Reputation: 25797
Firebase console only allowing 1000 characters in the notification body:
Upvotes: 6