Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending tags containing special characters to Azure Notification Hub

We want to use Azure Notification Hubs in our iPad app but we have run into a problem. The tags that determine who gets the push message is an email address and it works fine if it only contains normal characters. But it does not work when we try to send a tag looking like this:

[email protected]

or

test%[email protected]

We are using this method to send push from the backend:

http://msdn.microsoft.com/en-us/library/windowsazure/dn539552.aspx

When we do so we get this message:

Invalid tag [email protected]:48b6f399-3f27-40b4-a6f9-b0838623c9c3_G19,TimeStamp:12/10/2013 12:38:38 PM

Invalid Request (400)

We have looked through the documentation to see if it states somewhere that we need to encode tags in a special way but have found nothing.

We cannot imagine that this is not possible since it must be a common scenario. Hope someone can help.

Cheers

like image 554
blackpool Avatar asked Sep 19 '25 21:09

blackpool


2 Answers

I found slightly different information to Elio:

A tag can be any string, up to 120 characters, containing alphanumeric and the following non-alphanumeric characters: ‘_’, ‘@’, ‘#’, ‘.’, ‘:’, ‘-’.

Source

So '~' is invalid (I can confirm this from experience).

like image 194
Dunc Avatar answered Sep 22 '25 22:09

Dunc


The allowed characters in tags are: ASCII-7 alphanumeric characters plus {‘.’, ’-’, ’_’, ’~’, ‘:’, ‘@’, ‘#’}. Max length is 120 chars.

You can encode arbitrary strings by encoding it in binary and then hex.

Info Source

like image 37
Elio Damaggio Avatar answered Sep 22 '25 23:09

Elio Damaggio