When sending notifications to FCM, either from my Azure Service via Azure Notification Hub or it's test send, I am not getting any error messages, but the notification is not delivered to the specified device. The hub's test send reports "Message was successfully sent, but there were no matching targets." However, from the FCM portal test send it is, so I know the device is configured correctly.
Is it FCM reporting "no matching targets" or the hub?
I have tried a variety of device ids as targets, both the token received from FCM by the device and variations of the FCM Token generated by the GetFMToken method.
Using VS, I see in the hub registrations for APNS; I don't see any for FCM, even though I have seen registration events for my pushes in the hub's Overview Monitoring.
An example of the latest notice semantics:
"{ "priority": "high", "data": { "Raw": "PIDMe54*****64Test190801142953088468/1/2019 2:29:53 PM"}, "notification": {"channel_id": "MyNotications"}, "to" : "f-E6xD_YkFs:APA91bEsHI_Fc9zNKFfYWm2b5-ebVuS-Kp8WLMM0YgWVv6fc6dXpqvwJGUNedE9ZfaBpiDC69IQJt4hjizm98l7Lbo3RzyeHi5dAzKnFvKNZ4nCgEIoQShEGfgB5AkhS-2j7LXtcjudC"}
I expect just ""Message was successfully sent" and the notification delivered.
Related
I'm using Azure Alerts to use webhooks. I added the webhook in the action group. The URL I used is the one from Slack.
I also added a Notification Type Email. The notification email gets triggered but I am not receiving any message in the Slack channel.
I was able to push messages to the webhooks using postman hence I know my webhook is correct. But Azure Alert is not able to trigger the webhook. I am not receiving any messages in the Slack channel.
Azure Monitor sends a notification with its own schema definition. Slack doesn't recognize it, so you cannot see any notifications in the channel. It is possible to create a Logic App or Azure Function to transform the default schema.
Here the more information about it:
https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-common-schema
Slack expect a json object when using webhooks. When sending directly from azure alert you will get bad request.
Every slack channel has an e-mail adress. You can post messages to the channel using that email in azure alerts
Anyone looking for using Slack and Azure Alerts. This seems to work fine:
...
webhook_receiver {
name = "Slack"
service_uri = "https://hooks.slack.com/services/secret"
use_common_alert_schema = false
}
Then in the scheduled query rules alert:
...
action {
action_group = [data.azurerm_monitor_action_group.actiongroup.id]
email_subject = "Disk storage at less than 10%"
custom_webhook_payload = "{ \"text\" : \"Warning: Storage has less than 10% diskspace remaining!\"}"
}
I am using a web service api to receive message from a slack channel (event subscription) and the same web service api to send message (Incoming webhook) to the user on the same slack channel.
But when I send a message, this same message is send back to my api by the slack event subscription. That create an infinite loop.
How can I declare my message that I am sending to the channel which I can check when I receive back by the event subscription ?
This is normal behavior of Slack and can not be changed by any configuration. When you subscribe to message events you will receive events for all messages, including the ones from your own app.
To avoid an infinite loop you therefore need to detect and filter out the messages from your own bot before continue processing. This can be done easily, since all messages contain the name of the the sender. e.g. you can filter out all messages that are have the bot_id of your Slack app or all messages from bots (that have subtype = bot_message).
Here are some examples how messages look like and how messages from real users are different then message from Slack apps:
Example message from a real user:
{
"type": "message",
"user": "U12345467",
"text": "Good read for some of guys",
"ts": "1531745292.000021"
}
Example message from a Slack app or bot
{
"text": "Hey guys",
"bot_id": "B12345678",
"type": "message",
"subtype": "bot_message",
"ts": "1531700187.000049"
}
See also this answer.
I have some question about Azure notification hub.
It is possible to send push message to gcm or apns without registration devices? I would like only to pass e.g. gcm model like:
{
"to": "registraionId",
"data": {
"title": "Some title",
"message": "Some message"
}
}
I saw that exists defined REST https://msdn.microsoft.com/en-us/library/azure/dn223273.aspx but for me it not working, I suppose that flow should look like [make installation] -> [make registration] -> [send message] is it correct? I also tried to send message by visual studio and azure portal.
Is it possible to send messages without registration etc. ?
I will be very gratefull for any examples :)
I solved my problem, of course exists Rest api https://msdn.microsoft.com/en-us/library/azure/mt608572.aspx which is used to sending direct messages to devices without registrations.
I want to use REST API to send message to a servicebus topic.
Everything's working fine, the message is sent on the topic.
My client received an ACK fron servicebus by receiving an HTTP code 201, a void body, and some headers.
But I didn't received the messageId. I need it to retrieve treatment status in my internal product.
However, as at described into the documentation (https://learn.microsoft.com/en-us/rest/api/servicebus/message-headers-and-properties), the MessageId should be returned.
Is it normal? And how can I retrieve the MessageId?
The only other option is to set the MessageId by the client way, but I don't like this solution because it is not the responsability of the client to do that.
I use Notification Hubs to send Notifications to IPhone and Windows Store app. The IPhone is working perfectly fine, but there is some issue with Windows Store when sending the notification.
Error: The Push Notification System handle for the registration is invalid.
Template:
String WindowsTemplateStr = #"<toast><visual><binding template=""ToastImageAndText03""><image id=""1"" src=""https://"" alt=""Customer""/><text id=""1"">$(headlineText)</text><text id=""2"">$(bodyText)</text></binding></visual></toast>";
I use this code to register:
registration = await hubClient.CreateWindowsTemplateRegistrationAsync(userDeviceInformation.ChannelUri, Templates.WindowsNotificationTemplate,
new string[]
{
userDeviceInformation.InstallationId,
userDeviceInformation.UserName
});
The registration goes through fine and I can see the tags properly associated using "Service Bus Explorer".
When I try to send the Notification this is what I do:
notification.Add("src", ImageUrl);
notification.Add("headlineText", String.Format("Message from {0}", fullName));
notification.Add("bodyText", String.Format("Message {0}", message));
When the notification is sent, nothing is received on the device; and I see the registration is also being deleted.
I can't seem to find what is causing this behavior.
Any ideas ?
If WNS returns invalid handle then the corresponding registration will be removed from the notification hubs.
You can use test send to check the error details:
http://msdn.microsoft.com/en-us/library/microsoft.servicebus.notifications.notificationhubclient.enabletestsend.aspx