OAC – A Better Way to Unsubscribe from Agents

OAC has a nice button for a person to unsubscribe within an Agent itself. But this required a person to navigate to the catalog to find the agent and look inside the details of the agent.  Seems like a lot of steps to me.

firstimage

But what if you want to enable this capability for an end user from inside the received email, similar to normal unsubscribe functionality we are used to with other email subscriptions. We want a one-click solution, where the user needs no information about OAS, where to go in the Catalog to find an agent, or even what an agent is.

To research how this might be possible, I utilized the Chrome developer tools:

image (23)

Next, I logged into the OAC environment:

image (21)

On the right part of the screen we now see everything that is going on between Chrome and the OAC APIs underneath the covers.

NOTE: We select network on the top right tab of the Chrome developer panel. We can also check out the other tabs to see what else these developer tools give insight into. 

Subscribe and Unsubscribe

The agent OAC is nice enough to give us an unsubscribe button, but no subscribe button? Odd? Oversight? In my view, yes to both cases.

image (19)

We click on unsubscribe to see if the developer tool gives us insight into what the button actually does. Nothing stands out. Next we try viewing the agent from within the Catalog, and we see both the unsubscribe and subscribe buttons:

image (20)
image (18)

So, within the agent itself–and after subscribing–we can now see I am subscribed:

image (19)

We can go back and forth to subscribing and unsubscribing and viewing the relevant information in the Chrome developer pane:

image (17) copy
image (16)

For non-web developers, this seems like a lot of gibberish. But it looks promising for the task at hand: a simple click to subscribe/unsubscribe.

At the bottom of the right panel we select view source:

… and BAM!

image (3) (1)

We have a potential URL that can be used for our use case:

AlertPath=%2Fshared%2Faaaatest%2FDemo%2FDemo_Agent&Subscribe=unsubscribe&_scid=Aebc9mbi48JYye22m3z8&icharset=utf-8&urlGenerator=qualified

So it looks like part of the url, what else do we need? What are these parameters: scid and urlGenerator, etc.?

I found a useful document with excellent info for the methods, but no real guidance on how to implement those methods in OAC when we may have limited, non-administrative privileges.

subscribe () Method

We can use the subscribe() method to subscribe to a published agent. If the agent allows customization, then we can also specify the customization XML when applicable.

Signature

void subscribe(String path, String customizationXml, String sessionID);

ArgumentsDescription
String pathSpecifies the full path and name of the agent in the catalog. For example, /users/jchan/iBots/BrandDollars.
String customizationXmlSpecifies the customization XML (only if the agent allows customizations). This XML is validated against the customization schema available in orahome/bifoundation/web/schemas/analysis_customization.
String sessionIDSpecifies the session ID, which is usually returned by the logon method. If the SOAP client engine can handle HTTP cookies, you can omit the session ID or set it to null.

From the documentation,  they had “String sessionID”, and I guessed this was the same as ‘SCID’. So I tested omitting the session ID or set it to null,  and it worked in this scenario.  Since I was launching this from within the OAC interface this worked. I am assuming if you tried to perform this elsewhere you would need to get the SCID and include it into your command.

We test by creating a new OAC analysis that returns a single row of data:

image (15)

Then in results, we create a Static Text object:

image (14)

Then we can go to town using HTML, Javascript, etc. In this case, we only needed basic HTML:

<p>Email to check out the latest on <a href="https://<oac_url>/analytics/saw.dll?dashboard&PortalPath=%2Fshared%2FblahA%20blah%">blahDashboard</a></p>

<p><br></p>

To Subscribe to the weekly Dashboard, click: 

<a href="
saw.dll?Subscribe&AlertPath=%2Fshared%2Faaaatest%2FEMEA&Subscribe=subscribe&icharset=utf-8&urlGenerator=qualified" target="_blank">subscribe</a>

[br/][br/]

To Unsubscribe to the weekly Dashboard click: 

<a href="
saw.dll?Subscribe&AlertPath=%2Fshared%2Faaaatest%2FEMEA&Subscribe=unsubscribe&icharset=utf-8&urlGenerator=qualified" target="_blank">unsubscribe</a>

Here is the implementation of the HTML in our new analysis, checking the Contains HTML/Javascript/CSS checkbox as necessary:

image (13)

Final example results:

Screen Shot 2020-10-22 at 11.01.38 AM

In designing the final solution, I spent time experimenting with different variations of the URL:

Subscribe:

<a href="
saw.dll?Subscribe&AlertPath=%2Fshared%2Faaaatest%2FEMEA&Subscribe=subscribe&icharset=utf-8&urlGenerator=qualified" target="_blank">subscribe</a>

 

Unsubscribe:

<a href="
saw.dll?Subscribe&AlertPath=%2Fshared%2Faaaatest%2FEMEA&Subscribe=unsubscribe&icharset=utf-8&urlGenerator=qualified" target="_blank">unsubscribe</a>

 

These above functions can be fully qualified paths if you prefer:

<a href="
https://<analytics-instance>/analytics/saw.dll?Subscribe&AlertPath=%2Fshared%2Faaaatest%2FEMEA&Subscribe=unsubscribe&icharset=utf-8&urlGenerator=qualified" target="_blank">unsubscribe</a>

In the above example, <analytics-instance> is the main endpoint to the OAS instance. We should keep in mind that we likely would not want to use this out of deployment lifecycle concerns.

In conclusion, the solution was fairly simple to implement but complicated to discover. Also, an href attribute launches a new window, but does process the required subscribe and unsubscribe functionality correctly. I believe there are HTML/JavaScript/CSS ways of customizing this, but I didn’t spend the time to determine alternative approaches

Is your organization adapting to remain competitive? In the Architect Room, we design a roadmap for the future of your digital organization, while still capitalizing on current technology investments. Our knowledge spans a variety of offerings across all of the major public cloud providers. Visit Red Pill Analytics or feel free to reach out on Twitter, Facebook, and LinkedIn.

Is your organization adapting to remain competitive? In the Architect Room, we design a roadmap for the future of your digital organization, while still capitalizing on current technology investments. Our knowledge spans a variety of offerings across all of the major public cloud providers. Visit Red Pill Analytics or feel free to reach out on Twitter, Facebook, and LinkedIn.

Leave a Reply

Your email address will not be published. Required fields are marked *