Inspecting and debugging custom extensions in Watson Assistant
Troubleshoot your third-party API connections from Watson Assistant’s preview pane with the new Extension inspector
Earlier this year we released Watson Assistant custom extensions, allowing you to connect your assistant to any external system through third-party APIs. After listening to your feedback, we’ve improved the experience by enabling the inspecting and debugging of custom extensions in the Preview pane!
The new Extension inspector lets you test your custom extensions, see the requests and responses of your extension calls, and debug your extensions both within Watson Assistant and externally on your own computer.
Let’s see how it works!
Setting up and calling your extensions
Picking up where David left off in his previous explainer, let’s continue to connect a Hubspot account and create an assistant for others to create support tickets. Here, I replicated all the steps David made for creating an extension, then tested my assistant by creating a Hubspot support ticket:
Hmm, something went wrong here. It looks like a variable is missing, and that variable should be the support ticket number I received from the Hubspot extension call. I check my Hubspot account dashboard and don’t find any tickets that my assistant should have created. I’m beginning to suspect that maybe my Hubspot extension is faulty in some way.
Calling your extension inside the Preview pane
Here comes the cool new feature!
Instead of testing the assistant within my own website, let’s stay inside the Watson Assistant Actions page where I originally edited my action. On the bottom right corner of the page, notice there is a Preview button. Clicking here opens up a chat window equipped with a bunch of amazing debugging features. This part’s nothing new, but what is new is the third icon on the left of the preview pane — the Extension inspector!
Open the Extension inspector, and you’ll be met with a blank pane asking you to call an extension to get started. So, let’s do exactly that: I’m going to run through the same conversation, and get the same responses, except now I see a banner under the response saying an extension error has occurred, as well as a button inviting us to inspect.
Click Inspect, and the Extension inspector pane slides open.
The pane is immediately populated with the request parameters sent and response properties received from the Hubspot API call made by my custom extension.
The Request parameters section looks suspiciously bare. Let me cross-check that with the extension parameters I’ve set up in my action step’s Edit extension section:
Silly me! I forgot to fill all but one of my extension’s request parameters.
Replay your extension calls outside of Watson Assistant
So now my request parameters are filled in, but my extension is still bugging out. I think it is time to slide from the Overview tab to the Advanced tab in the extension inspector.
In the Advanced tab, I can see exactly what the response looks like in JSON format. My first glance tells me that my authentication or password could be the issue this time. But just to be sure, let me go to the Request CURL section above and copy the CURL command.
Using the CURL string, I can simply run the command from my own computer’s terminal or command line, exactly the same as when I made the extension call from the assistant. Running the CURL command is essentially as easy as copy and paste!
And I have confirmed: Both inside my assistant and on my own computer, the authentication token seems to be bad. I correct my token by copying it from my Hubspot account, test the conversation again, and both my extension and my conversation are finally working!
There you have it! I hope you were able to follow me through this simple example, see the value and ease of debugging custom extensions, and are inspired to try it out for yourself. After all, there’s a wide world of APIs out there. Find one that you love, make it into an extension, and connect it to your assistant!