Azure AI Content Safety – Blocklist Management in Optimizely CMS – Get Blocklist Items

In this article, I will illustrate how the blocklist management feature, provided by the Azure AI Content Safety service, can be used to retrieve blocklist items associated with a blocklist within Optimizely CMS.

The purpose of blocklist items is to supplement a blocklist that aids in detecting specific text content that may be deemed harmful or unnecessary.

Creating new Blocklist items can be achieved using a custom Add-On included in the NuGet Package “Patel.AzureAIContentSafety.Optimizely”. This Add-On can be obtained from the Optimizely NuGet Feed or at the NuGet Feed. The screenshot above shows this section within the Custom Add-On.

Blocklist items can also be added by using the Azure AI Content Safety Studio. However, it is necessary to create an Azure AI Content Safety resource as a prerequisite before applying this method.

The following screenshot below illustrates the code utilised to fetch the blocklist items from the Azure AI Content Safety API.

As shown in the screenshot above, The blocklist “Knight Frank” is selected from the dropdown menu. When this option is chosen and the button is clicked, the API will be activated to get the blocklist items for the chosen blocklist.

Response from the API via the Console

Azure AI Content Safety – GetTextBlocklistItems operation complete
TextBlocklist Items Count is 8

BlockItemId: 3f812081-039f-45cf-83e2-478277a71465
Blocklist Text: hello world
BlockItemId: 532efcb4-33a1-43f0-824e-689853d7a495
Blocklist Text: Plus, our expertise and time won’t cost you too much.
BlockItemId: 5e677064-3d65-4532-b629-4aa509899139
Blocklist Text: Let us do the easy work for you so that you can focus your expertise on running your business
BlockItemId: fd20d8f8-a352-4d0f-b23e-bba232ef1d60
Blocklist Text: We’re experts in finding you the perfect office space at the best price
BlockItemId: 70f5b858-3d8e-4ee6-ae34-02b838909c77
Blocklist Text: Discover how we can help you by navigating to the Property Services section of our website.
BlockItemId: ec957d2a-efcb-4f91-8237-70cf2085f871
Blocklist Text: We have expertise catering to every type of property requirement – locally, nationally and internationally
BlockItemId: b7b8cfab-e7b2-49b8-a747-912fd74aa175
Blocklist Text: We’re not only about selling houses and townhouses – take a look at our recommended services here
BlockItemId: e37b1174-b9ba-4513-a138-4b67367c82be
Blocklist Text: San Quirico d’Orcia has a guide price of ?1,900,000.

After retrieving the data, it will be displayed in a summary section within the Add-On. A screenshot of this is provided below.