How to setup Segmented Push Notifications through RSS

2024-11-15 14:45:59 UTC

Please read the basic (unsegmented) article before reading this article:
https://support.visiolink.com/hc/en-us/articles/200003651/


It is possible to enrich each <item> in the RSS feed with custom XML-elements that indicates that you wish to send the message to a user segment.
As the RSS specification dictates that custom elements must be defined in a XML namespace, these elements must be defined in the Visiolink-defined namespace "https://support.visiolink.com/hc/en-us/articles/200003651/" (exact string). This is important, otherwise the elements will not be recognized by the parser! In our examples we use the namespace prefix "vl", however you are free to chose your own.
We recommend to declare this on the root XML element:


<rss xmlns:vl="https://support.visiolink.com/hc/en-us/articles/200003651/">
...
</rss>


Technically a user segment is a list of device tokens. However, there exists various ways to deduce such a list.
We support two (three) types of segments on an <item>:


***) Link(s) to device token list(s) on your own web server:
Technically we parse the the link contents as 1-column CSV (separator:, enclosure:" escape:\). But because at the time writing this, a device token contains no "special characters", you can treat the file as a plain text file with one line for each device token.
With this method, you can host a CSV file for each possible segment on your web server. Of course, this file does not need to be static - you can generate it dynamically. However, please be aware that for each RSS feed check, we also need to make a request for each device token list, if the message (<item>) is a candidate for being created and sent. Therefore, please keep the full request-response time down, e.g. by pre-generating the list or using a cache.
A device token list file may look like this:


01ca1d9adc2212181323853c32bddaa875f65451e0fe839fff6117419990f599
APA91bHn4nIQ_HY2Vv7fZwF24JJzrHIMmYFSqkn8xslbAcbCKLwgHxRUehC6f2PgJb-gEzGX9Z4HxLgDOX-dp66WSKjKBkXx8FU-sUSBDvbsyWzP8cZi-GbcAEcivYKydO7xT_rxXfg2
APA91bG1GbcoAqZL2rG-zWc6VCpgsu61KPrlY1DigLk4M47rh28BgskfZp_GnKzo2lIcdkg_94PlaL_3tSwNOEDbGWPKjg3AM50o9_fG__I6xbF_SEZL3c4Q6X5DA_75Ko-OlGI6ulzK
051fe25c03a66d452036ff1a20dcd2eee8c5a30eceede880dd75d7276db86369
020523cb3d676e00644c4594e8c93399df6eed11a8b96d1987ab0be664a603fb


It is simple to enrich a RSS <item> with a link to the token list:
<vl:deviceTokensLink type="csv">https://my.domain.tld/devicetokens/my_segment.csv</vl:deviceTokensLink>


The "type" attribute is required, and please remember the XML namespace.
We support 10 of these links, so you are able to combine (merge) segments.


You can fetch active user device tokens by integrating with Google Analytics, but this is out of scope of this article.


***) Reference to a segment defined in Google Analytics:
This works because users (with push messages enabled) in Google Analytics
(GA) are enriched with a device token. Please be aware that Visiolink needs
credentials for GA before this method works.
It is out of scope of this article how to define segments in GA, but to use
this method, you need a "view id" and optionally a "segment id" from GA.
When you have these values, you can enrich a RSS <item> with them:


<vl:googleAnalyticsDeviceTokens>
<vl:viewId>113627285</vl:viewId>
<vl:segmentId>BoWcNHpiS965CeD8-gnHlg</vl:segmentId>
</vl:googleAnalyticsDeviceTokens>


We support only 1 of these references, and please remember the XML
namespace on all elements.
As the segment id is optional, you can omit the corresponding element.


***) All users pseudo segment (unsegmented):
If none of the segment XML-elements described above are present on an
<item> element, the message is treated as "unsegmented", i.e. the message
will be sent to all users!
To avoid accidents, we can enable a setting on your feed that require a
special XML-element (flag) to indicate that the message is intended as
unsegmented:


<vl:unsegmented />


Again, please remember the XML namespace.
If this setting is enabled, and none of the mentioned XML-elements are
present, the message (<item>) will be ignored.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments