I am using MongooseIM with MongooseIM-Push feature. I have configured FCM on both Android and IOS and Its working fine for both (tested by sending Notification push from node js code).
while using the MongooseimPush (running docker image) although the I am able to receive push on android still I am getting the below error for each stanza sent
11:46:00.372 [error] Unable to submit push notification. ErrorCode 460, Payload <<"{\"topic\":null,\"service\":\"fcm\",\"mode\":\"prod\",\"data\":{\"message-count\":1,\"last-message-sender\":\"a9jpmqz7sil9qdbr#localhost\",\"last-message-body\":\"{\\\"text\\\":\\\"nh\\\"}\"}}">>.Possible API mismatch - tried URL: <<"v2/notification/fdOXsUNXwHc:APA91bG2oIdmhrRZ5L3w2RCPE17sn9fur74LGYGnqHWl5p5o3Xr4Y-1YDhwjfhQAs4gLr7gOETsKDArL5wPuFXJGvoW2nrhr87DdAxvWpY0J4uh1ZuoZMTqn7w14vwg7kW48Lki9T8Xx">>.
11:46:00.383 [error] Unable to submit push notification. ErrorCode 460, Payload <<"{\"topic\":null,\"service\":\"fcm\",\"mode\":\"prod\",\"alert\":{\"title\":\"a9jpmqz7sil9qdbr#localhost\",\"tag\":\"a9jpmqz7sil9qdbr#localhost\",\"click_action\":null,\"body\":\"{\\\"text\\\":\\\"nh\\\"}\",\"badge\":1}}">>.Possible API mismatch - tried URL: <<"v2/notification/fdOXsUNXwHc:APA91bG2oIdmhrRZ5L3w2RCPE17sn9fur74LGYGnqHWl5p5o3Xr4Y-1YDhwjfhQAs4gLr7gOETsKDArL5wPuFXJGvoW2nrhr87DdAxvWpY0J4uh1ZuoZMTqn7w14vwg7kW48Lki9T8Xx">>.
No error in Docker
11:48:37.174 [debug] Sent 200 in 86ms
11:48:37.327 [debug] Sent 200 in 245ms
11:48:42.580 [debug] POST /v2/notification/dU5K-csGDQ8:APA91bH6V4ctXe_tFy8xE6jfCVLCbS4lMuEU4SlFxZqAF85Hb9I-eoZhRQCfCXSw-JenX8xJ5DYnfSDTyzdoj0JmizdRCmNnCDPecevQj3r6waoYQhRKE_xOKBNLDAQVifn7VzPDwsCX
11:48:42.582 [debug] POST /v2/notification/ffFcxJGqD7Q:APA91bHCGy6qA-i2dzjIVDxBvevo3hcCzbBXXB1JrdFclpalGwaWCdE3PAd-XtEKj9MIJxITnOA7E3l_lUkRPvQybGbGDAkH3sNBawRFekQEocxHnQxJize_BoY4I10GieYY0_4602Xd
Following are the config in mongooseim config file
{mod_event_pusher, [
{backends, [
{push, [{wpool, [{workers, 100}]}]}
]}
]},
{mod_pubsub, [
{host, "pubsub.#HOST#"},
{plugins, [<<"push">>]}
]},
{mod_push_service_mongoosepush, [
{pool_name, mongoose_push_http},
{api_version, "v2"}
]}
{outgoing_pools, [
{http, global, mongoose_push_http,
[{strategy, available_worker}],
[{server, "https://localhost:8443"}]}
]}.
The response code 460 corresponds to invalid device token. As you said in comment you installed/uninstalled the app multiple times. It is possible that all the old tokens are no longer valid and Mongoose gets the 460 error. The notification succeeds because at least one (most probably the newest) token is valid. In order to remove previously registered tokens you can deactivate the token as described in XEP-0357#disabling. I also recommend reading the tutorial regarding Push Notifications with MongooseIM and MongoosePush [3].
The configuration you provided looks correct to me.
Related
I have issues pushing to amplify after adding resource same problem, after adding auth with
amplify add auth
amplify push
I get
Following resources failed
Resource Name: UserPoolClientLambda (AWS::Lambda::Function)
Event Type: create
Reason: AccessDeniedExceptionnull (Service: AWSLambdaInternal; Status Code: 403; Error Code: AccessDeniedException; Request ID: 8434d2a2-4287-4b79-b22f-5d95094436a0; Proxy: null)
× An error occurred when pushing the resources to the cloud
Resource is not in the state stackUpdateComplete
An error occurred during the push operation: Resource is not in the state stackUpdateComplete
How I resolve this ?
PS: amplify cli is version 4.41.2
Finally able to figure it out.
My issue has something to do with my exposed api key case with my users.
I had help from the AWS support. Initially, I was just going to fix my billing payment method, and they mentioned that they locked my account due to the exposed api key. They walked me through it to rotate my API key and I just waited around 3-5 hours to get my account unlocked.
I tried it after following the same steps and it worked
$ amplify add auth
$ amplify push
I'm having issues with extracting channel messages from a Microsoft Team. I have a javascript app that crawls through all Teams in a organization and extract the number of messages from all channels in all the teams. It works wonderfully in that it return the correct amount of messages, the problem is that when the app try to fetch a message from a channel where no one have made a message in the channel there is an HTTP error with the ErrorCode 403 (forbidden). Even though the app is successful in that it delivers on what it is supposed to do, I can't have an application that sends 50 angry, red messages every time it makes a http call.
The call I am using is the following
https://graph.microsoft.com/beta/teams/{teamID}/channels/{channelID}/messages
Does anyone know if this is solvable? If not is it possible to check if a channel is empty? And if that is not an option; is there anyone to hide those dirty error messages from the console?
Edit #1
To call to the api I used:
let header = new Headers();
header.append("Authorization", "Bearer " + accessToken);
header.append("Content-Type", "application/json");
fetch("https://graph.microsoft.com/beta/teams/232808c2-d500-47b0-9ead-e238c5e2ab95/channels/19:69a01be632994d123014bbae1aa5db1e#thread.tacv2/messages", {method:"GET", headers: header})
Edit #2
I response object seems to be correct:
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#teams('90baabba-1b5e-471c-a163-8a9b4b680de7')/channels('19%3A01c741f599e547f0b9b38296283b7fec%40thread.skype')/messages",
"#odata.count": 0,
"value": []
}
The problem is that in when I look in Google Chrome > Dev tools > Console, the fetch still displays the error:
GET https://graph.microsoft.com/beta/teams/4f460179-4691-42e5-8677-9101dcdb65fe/channels/19:3497f5b8f9f54149919631b32d21e608#thread.tacv2/messages 403 (Forbidden)
And when I console log the error it just displays as:
error: {code: "Forbidden", message: "Forbidden", innerError: {…}}
Only team members are allowed to read messages. Admins can do team management i.e. CRUD operations on teams, channels, tabs etc. They however cannot read messages. This is intentional and we do not have plans to change this in near future
I am getting error while sending message using Firebase cloud messaging admin API.
Error message is below
Caused by: com.google.api.client.http.HttpResponseException: 400 Bad Request
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
Let me put my admin configuration here..
FileInputStream serviceAccount = new FileInputStream("My service accout file.json");
FirebaseOptions options = new FirebaseOptions.Builder().setCredentials(GoogleCredentials.fromStream(serviceAccount))
.setDatabaseUrl("https://deliveryeat-1aa42.firebaseio.com").build();
FirebaseApp.initializeApp(options);
Message sending code is below
// This registration token comes from the client FCM SDKs.
String registrationToken = "YOUR_REGISTRATION_TOKEN";
// See documentation on defining a message payload.
Message message = Message.builder().putData("score", "850").putData("time", "2:45").setToken(registrationToken).build();
// Send a message to the device corresponding to the provided
// registration token.
String response = FirebaseMessaging.getInstance().sendAsync(message).get();
// Response is a message ID string.
System.out.println("Successfully sent message: " + response);
maven dependencies that i am using is following
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>5.9.0</version>
</dependency>
So can anyone help me in this? What am I doing wrong?
Yet another cause of this is that your message is too large:
Notification messages can contain an optional data payload. Maximum payload for both message types is 4KB, except when sending messages from the Firebase console, which enforces a 1024 character limit.
https://firebase.google.com/docs/cloud-messaging/concept-options
One possible cause for this is that the client and server are connected to different firebase projects. Project name appears in the google-services.json file on the client and in the credentials json on the server.
Firebase FCM: invalid-argument
I suspect that your registrationToken has an invalid format. It should be 152 characters.
To confirm that, try building your message with setTopic("test") instead of setToken(registrationToken).
In my case, the problem was that certain keys are not allowed in a notification data payload. Specifically, the key 'from' is forbidden.
Firebase data message payload
I had my project name uppercased in the URL (strange, because my project name is actually uppercased)
I received this error trying to set the 'content_available' flag to true (which is what the docs say to do: https://firebase.google.com/docs/cloud-messaging/http-server-ref).
Turns out you need it to be 'content-available' instead.
In my case the problem was in Condition part.
I used invalid characters.
For example wrong: 03:00' in topics
This error also occurs when trying to send a push-notification to an iOS simulator device.
I'm trying to authenticate against an App Service that I have defined in Azure Active Directory. When accessing it, I first get the access token and the continue with the rest of the OAuth procedure.
The problem, however, is that I can only get the token when posting the request via Postman. When I try to call the same URL, with the same data using an HTTP action in flow, it fails:
{
"error": "invalid_client",
"error_description": "AADSTS70002: Error validating credentials. AADSTS50012: Invalid client secret is provided.\r\nTrace ID: 67250fbf-ad20-47f1-b3a3-dbce1e813600\r\nCorrelation ID: f9eaaa13-cee3-4f5c-a96a-6846c4392dd9\r\nTimestamp: 2018-01-17 12:21:51Z",
"error_codes": [
70002,
50012
],
"timestamp": "2018-01-17 12:21:51Z",
"trace_id": "67250fbf-ad20-47f1-b3a3-dbce1e813600",
"correlation_id": "f9eaaa13-cee3-4f5c-a96a-6846c4392dd9"
}
This is how it is set up in Flow:
When executed in Postman it works just fine:
I cannot figure out why this doesn't work when running the request from within a Flow. Am I missing something in the HTTP action card configuration?
Kind regards,
Peter
I found the reason for this not working. I had to fully URL encode the value for client_secret.
/Peter
There is a push notification service that sends a message from a web server to an app device. The app has onMessageReceived() method implemented. However, not all the messages are being delivered and I have read somewhere that the delivery_receipt_request field, when set to true then (FCM), replies to the server mentioning the message being either delivered or not. I want to know that how can I catch that reply from the app if the message is delivered to my sender's side code.
Option 1: Via XMPP
You need to run an XMPP client on your backend. This client should connect to FCM with your project parameters. You will then be able to process message delivery stanzas sent to you by FCM. Here are the baby steps:
Follow the steps in https://www.npmjs.com/package/node-xcs to setup the XMPP client, exporting environmental variables with your FCM project parameters.
You can send messages through there.
Listen for message delivery stanzas:
client.on('stanza', function(stanza) {
//HERE IS WHERE YOU PROCESS THE STANZA
console.log('Please process me. I AM, the stanza: ', stanza.toString())
})
The stanza you will get for message delivery will look like this:
<message id="">
<gcm xmlns="google:mobile:data">
{
"category":"com.example.yourapp", // to know which app sent it
"data":
{
“message_status":"MESSAGE_SENT_TO_DEVICE",
“original_message_id”:”m-1366082849205”
“device_registration_id”: “REGISTRATION_ID”
},
"message_id":"dr2:m-1366082849205",
"message_type":"receipt",
"from":"gcm.googleapis.com"
}
</gcm>
</message>
Currently only CCS (XMPP) supports upstream messaging. Knock yourself out.
Option 2: Via HTTP
Now, if you decide to use the FCM HTTP protocol instead to send the messages, then you will have to interpret the response that you get back when you make the HTTP call. You can tell whether the message was delivered or not by looking at the HTTP response header and the error in the body of the response. The structure of the response is described here: https://firebase.google.com/docs/cloud-messaging/http-server-ref#interpret-downstream
Again, knock yourself out.