Which attribute should I use when push message in Firebase Cloud Messaging, 'text' or 'body'? - firebase-cloud-messaging

I have been using push notification in Google Firebase Cloud Messaging API since 2016. But I got issue on 7th of January in 2020, and since then it doesn't work.
I'm finding right attribute for the API parameter.
Previously : 'notification' => ['text'=> $action]
Changed (work) : 'notification' => ['body'=> $action]
Is body the right parameter?
If not how can I find the right parameter ?

The documentation shows this example of a message body:
{
"message":{
"token":"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
"notification":{
"body":"This is an FCM notification message!",
"title":"FCM Message"
}
}
}
So it looks like body is indeed the proper name for the property to use.

Related

WhatsApp Business Platform API using Test account doesn't send the message to Mobile

I have created a WhatsApp Business Platform Test account. I am able to send and receive the hello-world template message but when I send a test message without template(as specified by the api) it doesn't push it to the mobile phone. Strangely I get success response in both cases.
Url: https://graph.facebook.com/v15.0/11ZZZZZZZZZZZZZ/messages
Here are the jsons and their responses
{
"messaging_product":"whatsapp",
"to":"91ZZZZZZZZZZ",
"type":"template",
"template":{
"name":"hello_world",
"language":{
"code":"en_US"
}
}
}
{
"messaging_product":"whatsapp",
"contacts":[
{
"input":"91ZZZZZZZZZZ",
"wa_id":"91ZZZZZZZZZZ"
}
],
"messages":[
{
"id":"wamid.HBgMOTE3MjkwMDIxMzYwFQIAERgSMjZCRkQ3RDc0RjM0QkNEZZZZZZ=="
}
]
}
In these case I successfully receive message on the mobile
{
"messaging_product":"whatsapp",
"to":"91ZZZZZZZZZZ",
"type":"text",
"text":{
"preview_url":false,
"body":"Hello World Testing"
}
}
{
"messaging_product":"whatsapp",
"contacts":[
{
"input":"91ZZZZZZZZZZ",
"wa_id":"91ZZZZZZZZZZ"
}
],
"messages":[
{
"id":"wamid.HBgMOTE3MjkwMDIxMzYwFQIAERgSQUJERkM2RUE1RTEwQTExZZZZZZ=="
}
]
}
However I don't receive message on the mobile.
Is there anything I am missing in the second case?
I was strugging with the same problem, but I figured out that you need to reply back to your first template message with a 'hello' or any kind of reply. Once you reply, only then can you send a message through that watsapp api without a template, or you can inititate conversation through watsapp api.
Hope this answer helps you.

Is it available to pass interruption-level (iOS) through firebase cloud message?

Trying to send push notification throug FCM using
POST https://fcm.googleapis.com/fcm/send
Is a way to send interruption-level to aps on push notification?
According to the HTTP API spec you can provide the APNS payload via apns key in JSON with the appropriate values:
{
"apns": {
"payload": {
"aps": {
"interruption-level": "active"
}
... other APNS-specific keys such as alert, title
}
},
... your other keys such as targeting
}
Note that for some interruption-level values to work (critical or time-sensitive) you need to have the app signed with the correct entitlements.

Odata v4 and axios request for React native has error on IOS only, Android has good response

I have used a get Axios request with Backend Dynamics 365 that has Odata for Rest APIs.
I have a good response on a get request API that has no parameters. But When I use other get APIs that have a parameter, then I get an error response with data.
"data": Object {
"error": Object {
"code": "",
"message": "The supplied company name is not valid.",
},
},
API URL:
Request type: GET
/APP/ODataV4/Company('United%20Traders%20Syndicate%20P.Ltd')/AppVehicles?$filter= appUsername eq 'SUMBEAST'
This error does not occur in android.
Issue some how solved by removing
/Company('United%20Traders%20Syndicate%20P.Ltd')/
removed the required part from the API with help of backend developer
guess ios doesnot take % properly

Google Assistant - Account linking with Google Sign-In

I have an Express app which supports Google authentication and authorization via passport. I have begun integrating it with Google Assistant and things were going quite well but I am having trouble with the account linking as described at https://developers.google.com/actions/identity/google-sign-in#start_the_authentication_flow
Using the method in the docs at https://codelabs.developers.google.com/codelabs/actions-2/#4 I was able to get user details but when I try to modify to support
app.intent('Start Signin', conv => {
conv.ask(new SignIn('To get your account details'))
})
and
app.intent('Get Signin', (conv, params, signin) => { ...}
the dialogflow always falls back to my default fallback intent and I get an error in Express console
Error: Dialogflow IntentHandler not found for intent: Default Fallback Intent
My dialogflow intent is set to use webhook and other intents work fine (until I add these sign-in intents!)
Reading this thread Dialogflow IntentHandler not found for intent: myIntent (Dialogflow V2) it was suggested that the intent name rather than the action name is used so I check my Actions on Google simulator and the request contains:
"inputs": [
{
"intent": "actions.intent.SIGN_IN",
"rawInputs": [
{
"inputType": "KEYBOARD"
}
],
"arguments": [
{
"name": "SIGN_IN",
"extension": {
"#type": "type.googleapis.com/google.actions.v2.SignInValue",
"status": "OK"
}
}
]
}
],
so I tried updating my Dialogflow intent name to actions.intent.SIGN_IN and modifying the intent name in my Express app accordingly but it doesn't make any difference.
The simulator response includes:
"responseMetadata": {
"status": {
"code": 14,
"message": "Webhook error (206)"
},
but I'm not sure if that is just because for some reason the intent names are not matching up. Any help much appreciated!
As you speculate in the comments, the issue is that your "Get Signin" Intent isn't registered to get the event indicating that the user has signed in (or failed to). Since there is no such Intent setup, it ends up calling the Fallback Intent, which apparently doesn't have an Intent Handler registered in your webhook.
To make your "Get Signin" Intent get the sign-in event, set the "Event" field to actions_intent_SIGN_IN. (Note the similarity to the Intent name you saw in the simulator, but using underscores instead of dots.)
As an aside, the simulator was showing you what the communication between the Assistant and Dialogflow looks like, so it can be somewhat confusing to understand what Dialogflow is doing with it. It didn't have anything to do with the name of your Intent or anything else.
Finally, it often isn't necessary to do this check. You will know if the user is signed in because either the auth token has been set or the id token has been set (depending on your method of Account Linking).

Firebase Cloud Messaging topic send, message does not show in Notifications and is never sent

I am using the REST api and I am trying to send to a topic. I know the topic exists because I can see in the Notification console that the topic is there. And I can send a test message through the console and that works.
However, when I use the REST api, I get an http status 200 response with json {"message_id":8769790390495267408} which looks like a successful send. However, the message does not show up in Notifications and the message is not sent to subscribed clients.
My message looks like, which is from the docs
https://fcm.googleapis.com/fcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
{
"to": "/topics/foo-bar",
"data": {
"message": "This is a Firebase Cloud Messaging Topic Message!",
}
}
And I am using the "Server key" and not the Web api key.
Thanks for any help.
For iOS, try using notification instead of data. Then add in the priority and set it to high. The payload should look something like this:
https://fcm.googleapis.com/fcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
{
"to": "/topics/foo-bar",
"priority": "high",
"notification" : {
"body" : "great match!",
"title" : "Portugal vs. Denmark",
"icon" : "myicon"
}
}