return null notificationId in NotificationHub - azure-notificationhub

I use Microsoft.Azure.NotificationHubs in VS2017. when I try to send a notification by SendAppleNativeNotificationAsync method this doesn't return notificationId, this is null. I have the Standard pricing for Notification Hub
enter image description here

Are you using Test Send by any chance? Please note that NotificationId is returned NULL while doing a test send. This is because you can get the result of Send operation in the output of Send* method itself. NotificationOutcome.Results property will have list of registrations this Send* was sent to. (Note that test sends are only meant for troubleshooting purposes and they target a maximum of 10 devices. Read through the above post for more info).

I worked with REST API I did a simple test and it worked correctly Send an APNS Native Notification, azure-notificationhubs here I found everything necessary for my problem

Related

Huawei push API throws error saying token count is wrong in postman

Using push API continuously returns token count should within 1 and 1,000. Please find the API error in the screenshot.
The possible causes of this problem is, you have placed the “token” attribute in wrong place.
Solution:
Please keep your “token” attribute within the “message” object,.
enter image description here
For details, check the following documents:
https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-server-dev-0000001050040110
Your token is outside the message body, "token", "android" should be within the message body.
Please check the sample code here
Also, if you want to use more tokens (>1000), the best method is to invoke the API using App server and send messages in batches.

How to receive cumulocity real time notifications with SmartREST?

We use the cumulocity REST API. Regular real time notifications work, e.g. we subscribe to /alarms/*, start our connection/polling loop and when we create an alarm we receive the expected JSON. We did not install any specific modules or statements, it just works.
But when we try to do the same with SmartREST we receive this error, as soon as the alarm is created:
40,,/alarms/177649296,Could not find any templates subscribed for the channel
Following the reference guide (http://cumulocity.com/guides/reference/smartrest/) we tried it like this, where all requests have the same X-Id-header and all requests result in the expected http status 200 and no error messages, except for the last one:
Register a smart response template by doing a POST to /s
Body: 11,102,,,$.channel
Handhake: POST to /cep/realtime
Body: 80
Response is our clientId (e.g. 191het1z38bp7iq1m96jqqt8jnef)
Subscribe: POST to /cep/realtime
Body: 81,191het1z38bp7iq1m96jqqt8jnef,/alarms/*
Connect: POST to /cep/realtime
Body: 83,191het1z38bp7iq1m96jqqt8jnef
In the normal REST case the notification consists of a JSON array with 2 elements, both of which have a property "channel". So that is what we would expect from our response template. Instead, we get the aforementioned error 40.
Is our response template wrong? Is it not properly matched by the X-Id? What does it mean, that there are no "templates subscribed for the channel"? The subscriptions are done for a clientId, and not for a specific response template, and the templates are supposed to be matched automatically anyway. So probably "template" means "X-Id" here? The documentation seems ambiguous as to the meaning of that word. But anyway, we did use the same X-Id header in all of the requests.
Any pointer about what we're doing wrong would be appreciated, since we tried pretty much anything by now.
The SmartREST protocol was developed for a IoT-device <-> platform communication. So there was never any design around using it to subscribing to realtime data (except of course for the operations a device needs) as usually devices to not need subscribe to the data that they created themselves.
That said it is possible to use it but with a couple of limitations. Your approach is basically correct but there is one problem with the subscription. The wildcard subscriptions will not work with SmartREST because on subscription it links your X-Id with the channel you subscribed to but there is never a message published on the channel /alarms/*. Thus this kind of weird error message that said that there was no template subscribed for the channel the alarm appeared on. Inside CometD you still receive the alarm because of the wildcard subscription but the SmartREST part does not work.
The messages are published on the channel with the deviceId (e.g. /alarms/12345).
If you subscribe to /alarms/12345 it will work. You can of course subscribe to as many channels as you want but wildcard subscription won't work.
Regarding the templates you need to know the following. The SmartREST parsing is not done on the raw JSON of CometD but on the payload inside it (e.g. the alarm). So a template for an alarm could look like this:
11,500,,$.severity,$.id,$.type,$.severity
This would trigger only if the object has a severity and would return id, type and severity.

Merge notifications with OneSignal

Using Ionic and OneSignal.
I am developing a messaging service in my app which sends push notifications when a new message is received. Ok so far.
But, I would like to merge notifications if they exceed a certain number, to avoid spamming the user with to much notifications.
Let's say if someone answer to one of my message with 3 different messages and that my app is in background, I would like the following to happen:
receive 1 notification
receive 1 other distinct notification
display only one notification which merge the previous two + a new one
Someone know, if possible and how?
I have just implemented something similar. You can look at the following documentation link
stacked notification
I just set the android_group parameter in all of my one signal api call and send a string key on every notification message.
{
app_id = "xxxxxxxxxxxx"; // one signal app id
headings = "One Signal Title Test";
content = "The demo test message";
android_group = "demo-application";
included_segments = "Active Users"; // to send notification to all active users
}
use postman to test
There's couple of parameters that you can set to group messages.
on Android you can use android_group witch accept a string and based on docs:
Notifications with the same group will be stacked together using Android's Notification Grouping feature.
And on iOS you can use thread_id witch also accept a string:
This parameter is supported in iOS 12 and above. It allows you to group related notifications together. If two notifications have the same thread-id, they will both be added to the same group.
There are couple more parameters that might be useful that you can check on Grouping & Collapsing OneSignal Docs

how to use setwebhook in telegram?

Hello I'm creating a bot in telegram. I send a http request:
https://api.telegram.org/bot(mytoken)/setWebhook?url=https://mywebpagetorespondtobot
and I receive this:
{"ok":true,"result":true,"description":"Webhook was set"}
but It doesn't work.I mean telegram doesn't send updates to the server.
Is this because I didn't upload my certificate?how should I do that then?
Check the status of your updates here:
https://api.telegram.org/botYOUR_TOKEN/getWebhookInfo
It will tell you about any errors. Should you not see any problems here the issue is to be found somewhere in your script. Make sure to handle incoming updates correctly.
It might be a problem with self-signed certificate. It needs to be uploaded via setWebhook method first as described here. Or try a more extensive guide here.
It's means what your public key incorrect.
You may check it by url https://api.telegram.org/bot{token}/getWebhookInfo
after setting
When i sent incorrect public key - i receive
{"ok":true,"result":{"url":"","has_custom_certificate":false,"pending_update_count":6}}
but if i sent correct public key, i receive:
{"ok":true,"result":{"url":"mycorrecturl.com","has_custom_certificate":true,"pending_update_count":6,"last_error_date":1506772578,"last_error_message":"SSL error {337047686, error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed}","max_connections":40}}
I changed the setwebhook url to a and it worked.it seems that it doesn't work with a wabepage url.
https://api.telegram.org/bot(mytoken)/setWebhook?url=https://mywebpagetorespondtobot/mymethod ' (the WebMethod)
BotFather -> Bot list -> API Token -> Revoke current token
https://api.telegram.org/bot(New token)/setWebhook?url=https://myweb...
Done)

Unable to set Deezer playlist to private using api

I am working on a project where we create playlists in Deezer using the api, we have been doing this successfully since the call to make it was implemented. However one of our testers noticed today that the Playlists were no longer private. I can verify this is the case in the Deezer api explorer and in my code.
Go to http://developers.deezer.com/api/explorer?url=playlist/4341978# (need to change id to a playlist that your account has created and use getToken feature)
Change the method to post
Add parameter public with value of false
Open console and watch response
Will return an "Input Error" message
The exact same thing is happening in my code when sending the same kind of request (including the token as a parameter) which has previously definitely worked as intended.
Do you know if the api has changed and I am missing some extra parameters or config? Or possibly there is error which is causing this?