Skip to content

channelsSerialized

Type Default
JSON String None

The channelsSerialized option is used to dynamically create a set of news filters as a temmporary Channel. It uses the same syntax as a regular Channel, but allows the widget user to create a channel as part of the widget itself.

channelsSerialized

Channel Strings

Channel strings are a JSON-encoded string that represents a full channel. As opposed to supplying one or more entity IDs or symbols to a widget, this allows for the dynamic creation of complex filters.

The general format of channel strings is an array of “stages”, representing one of the blocks in a standard channel stage.

Channel Stages

All contents of stages are logically OR’d together, and stages themselves are AND’d together. For example, in the above image, we filter for content that is about ((Apache Flink OR RabbitMQ OR Elasticsearch OR ….md) AND (From the CVE Twitter Page OR From Packet Storm.md).md). This is essentially the resulting Boolean filter for content.

Now that we understand the concept of channels & stages, we can discuss the format of the channel strings themselves. As previously mentioned, they are simple a JSON array of stages. For example:

[ {not: false, entities: [{type: "entity", value: "1874267", options: {}}]} ]

This is a single stage channel string. Each stage is an object that consists of a “not” Boolean, and an “entities” array. The “not” Boolean determines if we want to include or exclude matches. For example, if the stage consists of “Twitter” and “not” is true, then all Twitter content is filtered out. However, if “not” was set to true, then it would return any Twitter content.

The “entities” key is an array of specific filter items. Each items has a “type”, “value”, and “options” field:

  • Type: The type of the thing we’re filtering. It can be either “entity” or “keyword”.
  • Value: This will change depending on “type”. If type is set to “entity”, then you should set “value” to be the entity ID. If it’s “keyword”, then “value” should just contain the keyword.
  • Options: This is an object. Right now, the only option you can specify is “relevance”, which can be set to either “low”, “medium”, or “high”. This is only valid for “entity” types. It defaults to “low”, so you do not need to always specify this.

Since this can be a bit annoying to write out, it can be helpful to use the app itself to create a channel, and then see the generated object. To do this, go to whatever channel you’re interested in. Go to the “News” page. Open your browser’s DevTools (Chrome.md), and navigate to the “Network” tab. Click the refresh icon in the news widget, and you should see one or more requests appear in the DevTools popup. Click on the news request, and you can see the POST body. You’ll notice the “stages” object in the body – this is essentially the same as the channel string.

Example String

[{"stages": [{ "not": false, "entities": [ { "type": "entity", "value": 246 } ] }, { "not": false, "entities": [ { "type": "keyword", "value": "iphone" } ] } ] }]

This string restricts the search to Apple (id = 246.md) AND "iphone" (Keyword.md).


Help Home FTS Apollo™ Help RegLens® Help


Last update: November 29, 2021
Back to top