Comments (3)
Hi @theanhoo ,
Apparantly FCMv1 does not tolerate values that are not a string within data
payload. I'm adding bugfix task to esl/sparrow
backlog.
Until this is resolved please pass all values as strings to MongoosePush API - here the problem is specifically with: "message-count": 1
.
from mongoosepush.
Hi, @rslota,
I've removed binary_to_integer
from the following function in MongooseIM:
%% Create notification for API v2
make_notification(v2, Notification, Options = #{<<"silent">> := <<"true">>}) ->
%% MessageCount = binary_to_integer(maps:get(<<"message-count">>, Notification)),
MessageCount = maps:get(<<"message-count">>, Notification),
{ok, #{
service => maps:get(<<"service">>, Options),
mode => maps:get(<<"mode">>, Options, <<"prod">>),
topic => maps:get(<<"topic">>, Options, null),
priority => "high",
data => Notification#{<<"message-count">> => MessageCount}
}};
make_notification(v2, Notification, Options) ->
{ok, #{
service => maps:get(<<"service">>, Options),
mode => maps:get(<<"mode">>, Options, <<"prod">>),
alert => #{
body => maps:get(<<"last-message-body">>, Notification),
title => maps:get(<<"last-message-sender">>, Notification),
tag => maps:get(<<"last-message-sender">>, Notification),
badge => binary_to_integer(maps:get(<<"message-count">>, Notification)),
click_action => maps:get(<<"click_action">>, Options, null)
},
topic => maps:get(<<"topic">>, Options, null)
}}.
This is the request:
{
"message": {
"android": {
"data": {
"last-message-body": "6",
"last-message-sender": "[email protected]",
"message-count": "1"
},
"notification": {},
"priority": "HIGH"
},
"data": {},
"notification": {},
"token": "XXX"
}
}
And this is the response:
2019-11-28T16:55:39.082 [debug] pid=<0.1820.0> action=send, item=request_response, to={#PID<0.1971.0>, #Reference<0.733623136.701235201.235185>}, headers=[{":status", "400"}, {"vary", "X-Origin"}, {"vary", "Referer"}, {"vary", "Origin,Accept-Encoding"}, {"content-type", "application/json; charset=UTF-8"}, {"date", "Thu, 28 Nov 2019 08:55:39 GMT"}, {"server", "ESF"}, {"cache-control", "private"}, {"x-xss-protection", "0"}, {"x-frame-options", "SAMEORIGIN"}, {"x-content-type-options", "nosniff"}, {"alt-svc", "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000"}, {"accept-ranges", "none"}], body={
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
Please advise.
Many thanks in advance.
from mongoosepush.
I have switched back to MongoosePush 1.0.6. That seems to work fine.
from mongoosepush.
Related Issues (20)
- MAM query archive response containing empty 'to' field HOT 1
- mongoosepush start error HOT 5
- Unauthorized error HOT 4
- Getting genserver crash every few minutes HOT 3
- Swagger HOT 2
- Inconsistent behaviour sending data payload on apns vs. fcm HOT 13
- TooManyProviderTokenUpdates HOT 3
- MongoosePush crashes at startup HOT 2
- MongoosePush crashes at startup HOT 1
- When hit MongoosePush API nothing to show in web browser HOT 1
- Failed to start H2 connection HOT 1
- where do I find sys.config? HOT 1
- Is it possible to disable SSL certificate for http endpoint? HOT 2
- Question - Is it possible to disable Push Notifications based on a user's 'Do not disturb' status? HOT 2
- Crash at startup with token.p8 - bad_auth HOT 3
- FCM not sending notification HOT 2
- Server cannot create ssl connection HOT 2
- Is it possible to send apns notification to fcm while using with mongooseim HOT 2
- `no_matching_pool` error while trying to send notification to fcm HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongoosepush.