When I'm sending the push notification, I want to set the priority to it.
I have check the reference link:
https://developer.huawei.com/consumer/en/doc/development/HMS-3-References/push-server-send#BadgeNotification
But I couldn't find exactly where to set priority.
I'm using this JSON format:
{
"validate_only": false,
"message": {
"notification": {
"title": "Big News",
"body": "This is a Big News!"
},
"android": {
"notification": {
"title": "Noti in Noti title",
"body": "Noti in Noti body",
"click_action": {
"type": 1,
"intent": "#Intent;compo=com.rvr/.Activity;S.W=U;end"
}
}
},
"token": ["AAWWHI94sgUR2RU5_P1ZptUiwLq7W8XWJO2LxaAPuXw4_HOJFXnBlN-q5_3bwlxVW_SHeDPx_s5bWW-9DjtWZsvcm9CwXe1FHJg0u-D2pcQPcb3sTxDTJeiwEb9WBPl_9w"]
}
}
Please help me by providing some reference.
The posted reference link is for the old HMS version 3 document. Please refer to the latest document.
Under section AndroidConfig Structure, there is an Urgency parameter for setting the message delivery priority:
Under the AndroidNotification Structure section, there is an Importance parameter to set the message notification priority.
Related
I'm currently trying to send a notification using the " Try this API " interface of Firebase.
I filled my Request Body with this :
{
"validateOnly": false,
"message": {
"notification": {
"body": "Body",
"title": "Title"
}
}
}
and the RequestParameters with
projects/myprojectid
I didn't check the Google API Key since my project doesn't have one, but I checked the Google OAuth 2.0.
After executing, I get this error :
{
"error": {
"code": 400,
"message": "Recipient of the message is not set.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "message",
"description": "Recipient of the message is not set."
}
]
},
{
"#type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "INVALID_ARGUMENT"
}
]
}
}
After some research, I don't understand what is missing in the request. Are all the parameters mandatory for the request ?
You're not specifying who the message is for, which is what the error message is trying to tell you. You can do by either including a token key with one of more device tokens, or a topic or condition key in the JSON.
Also see the Firebase documentation on building requests to send a message for more information and examples of each of these.
I am new in Learning Dialogflow, What i am trying is to save the conversation of user and the bot.
i can already save the user response to the bot but i also want to save the bot response to the firebase.
my code is like this
function HandleSaveToDB(agent){
return admin.database().ref('data').push({
bot_response: request.body.queryResult.queryText,
user_response: request.body.fulfillmentText
});
}
the bot_response is saving but the user_response is not saving.
here is the response of the JSON
{
"responseId": "50359194-cadb-44a4-b649-ebd8e4606fea-425db6e2",
"queryResult": {
"queryText": "Hi i am paul i need help",
"parameters": {
"given-name": "Paul",
"text": ""
},
"allRequiredParamsPresent": true,
"fulfillmentText": "Hi Paul how can i help you today?",
"fulfillmentMessages": [
{
"text": {
"text": [
"Hi Paul how can i help you today?"
]
}
}
],
"intent": {
"name": "projects/chatsimulator-rttunh/agent/intents/dbc7dbf8-ca8d-4f7a-86b5-a0e6eab7e0b5",
"displayName": "Greetings"
},
"intentDetectionConfidence": 1,
"diagnosticInfo": {
"webhook_latency_ms": 4992
},
"languageCode": "en"
},
"webhookStatus": {
"code": 4,
"message": "Webhook call failed. Error: DEADLINE_EXCEEDED."
}
}
I'm presuming you're talking about a Fulfillment function being hit here.
The fulfillmentText is actually located in request.queryResult.fulfillmentText, despite what you see as the output from the diagnostic info.
Please see the spec for the fulfillment request and the queryResult property of that request.
now I'm testing http request using POSTMAN
**"to": "/topics/all", ---> ?? how can i write this line??**
"priority": "high",
"notification": {
"title": "テスト Title",
"body": "テスト Body"
},
"data": {
"click_action": "FLUTTER_NOTIFICATION_CLICK"
}
I checked status 200 ok
when I send message with firebase web page, it works well
but without firebase cloud message service, it doesn't work
In firebase cloud message service, the targeting condition is
I'm suppose that if i can write targeting condition in http format, I can send message to my app
help me
What you are looking for is key "topic"
{
"topic": "all",
"notification":{
"title": "テスト Title",
"body": "テスト Body"
},
"data":{
"click_action": "FLUTTER_NOTIFICATION_CLICK"
}
}
I could http post only with Input.Number now, but Input.Date and Input.Text both receive 400 error.
I was planning to create a Microsoft Flow to receive some value from Outlook Adaptive Card Action.Http Post method, I followed some articles from internet show me how to do that, finally I get rid of the 401 error because it needs Authorisation header.
Okay, then I moved on to test http payload. The body couldn't be something like "body": "test", otherwise it will either gives me an 400 or even not shows adaptive card in email at all. After I learned that I have to use they officially suggested {{someId.value}} into "body".
I succeeded for the first time with Input.Number:
{
"type": "Input.Number",
"id": "test1",
"title": "New Input.Toggle",
"value": "",
"validation": null,
"placeholder": "Placeholder text",
"min": "0",
"max": "60"
}
Then outlook tells me it is successful and I did get the endpoint flow run and receive correct payload. And this is the "Action.Http" part:
"actions": [
{
"type": "Action.Http",
"title": "Say hello",
"method": "POST",
"url": "myflowhttptriggerurl",
"body": "{{nameInput.value}}",
"headers": [
{ "name": "Authorization", "value": "" }
]
}
]
Below is what get error:
After then, I tried with Input.Text and Input.Date, they all give me 400, below is payload, and don't worry for Action.Http, I change id each time when testing:
{
"type": "Input.Date",
"id": "h",
"title": "New Input.Toggle",
"value": "",
"validation": null
}
Text payload:
{
"type": "Input.Text",
"id": "newTask",
"isRequired": true,
"placeholder": "Enter a new task"
}
OK, first I would install the "Actionable Messages Debugger" into Microsoft Office to make it easier to understand if the contents of your card is correct.
It appears from the card you are doing it correct, what happening on your flow that is receiving the message?
You could always try send through a JSON object, so your body will be
"body": "{\"comment\":\"{{comment.value}}\"}"
Where comment is the id of your Input.Text as such:
{
"id": "comment",
"type": "Input.Text"
"isMultiline": true,
"placeholder": "Comments"
}
I am trying to send to multiple messages within one Webhook call to Dialogflow, which shall be passed to Messenger. Right now my Webhook responds with a malfunctioning JSON body:
{
'fulfillmentText': "Text",
'fulfillmentMessages': [{
"platform": "facebook",
"text": [{
"text": "Text"
}]
}],
'source': "facebook"
}
When I test the Webhook via Messenger I see the is typing symbol, but never receive the Text message. While testing the same Webhook from the Dialogflow Console I get
Webhook execution successful
returned. I guess I am missing some JSON fields to tell Dialogflow in which format it has to send the JSON two the Messenger API. Anybody having any clues on how to solve this issue?
Edit:
My latest not working trial...
{
"fulfillmentText": "Hola!",
"fulfillmentMessages": [
{
"text": {
"text": [
"Title: this is a title"
]
},
"platform": "FACEBOOK"
},
{
"text": {
"text": [
"Title: this is a title"
]
},
"platform": "FACEBOOK"
}
]
}
If you're only sending text you only need to provide a string to the fulfillmentText and don't have to provide the fulfillmentMessages attribute.
If you do provide a fulfillmentMessages attribute with the target platform Dialogflow will send your payload to Facebook. In this case, where the payload is invalid, no message will actually be surfaced in Facebook. remove the fulfillmentMessages attribute of the response JSON and your bot should respond.
If you'd like to add a card to your response you can send the following response:
{
"fulfillmentMessages": [
{
"platform": "FACEBOOK",
"card": {
"title": "Title: this is a title",
"subtitle": "This is an subtitle. Text can include unicode characters including emoji 📱.",
"imageUri": "https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png",
"buttons": [
{
"text": "This is a button",
"postback": "https://assistant.google.com/"
}
]
}
}
]
}
EDIT: If you want to send multiple messages you can do so by sending a response like this (this JSON will send two identical cards but you can change the message type (card/text/etc) based on this documentation):
{
"fulfillmentMessages": [
{
"platform": "FACEBOOK",
"card": {
"title": "Title: this is a title",
"subtitle": "This is an subtitle. Text can include unicode characters including emoji 📱.",
"imageUri": "https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png",
"buttons": [
{
"text": "This is a button",
"postback": "https://assistant.google.com/"
}
]
}
},
{
"platform": "FACEBOOK",
"card": {
"title": "Title: this is a title",
"subtitle": "This is an subtitle. Text can include unicode characters including emoji 📱.",
"imageUri": "https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png",
"buttons": [
{
"text": "This is a button",
"postback": "https://assistant.google.com/"
}
]
}
}
]
}
I mailed the Dialogflow support about this issue and it turns out that it is currently not possible to send multiple messages from a webhook.
Hi,
At this point, it's not possible to send sequential messages directly
from webhook. However, if you are using one of our one-click
integrations that support rich messages, you can invoke intents in
which multiple messages are defined from webhook through an event as
described at
https://dialogflow.com/docs/events#invoking_event_from_webhook.
Let me know if you have any questions.
Regards, Ankita from Dialogflow