Installation API

APIs to programmatically add Tools

What is the Ask Steve Installation API?

We have exposed some APIs in the Ask Steve browser extension so that you can programatically add Tools to the user's Ask Steve installation. You can call these APIs via the chrome.runtime.sendMessage function. We use these same APIs in our Widget.

Getting the Extension Id

There are different Ids for the Chrome and Edge versions of Ask Steve. Here is how you can get the correct one.

const chromeExtensionId = 'gldebcpkoojijledacjeboaehblhfbjg';
const edgeExtensionId = 'hiefenciocpoafbgoocochpolfjfmjfg';
var extensionId = chromeExtensionId;

// Detect the browser
const userAgent = navigator.userAgent;
if (userAgent.includes('Edg/')) {
    extensionId = edgeExtensionId;
}

APIs

isExtensionInstalled

No arguments, returns {"status": true} if the extension is installed.

try {
    const response = await chrome.runtime.sendMessage(extensionId, {type: "isExtensionInstalled"});
    if (!chrome.runtime.lastError && response.status) {
        extensionInstalled = true;
        console.log('Extension installed');
}
} catch (error) {
    console.log('Extension not installed or unreachable', error);
}

areToolsUpToDate

Called with an object that has a skills property on it with all the Tools that you want to compare. If any of the Tools don't exist or have been modified, this will return {"status": false}, otherwise it will return {"status": true}

try {
    // are the tools already installed and up to date? 
    const response = await chrome.runtime.sendMessage(extensionId, {type: "areToolsUpToDate", data: asksteve_data});
    if (!chrome.runtime.lastError && response.status) {
        console.log('Tools are up to date');
    }
    else {
        console.log('Tools are not up to date');
    }
}
catch (error) {
    console.log('Extension unreachable', error);
}

addTools

Called with an object that has a skills property on it with all the Tools that you want to add. This will return {"status": true} if successful, {"status": false, "error": MESSAGE} if not.

await chrome.runtime.sendMessage(extensionId, { type: "addTools", data: asksteve_data });

Some notes about adding Tools:

  • The user will be shown a confirmation dialog where they can choose whether to install the Tools or not.
  • All Skill Ids and Connection Ids will be prepended with the hostname of your site if it's not already there. This way your Tools won't overwrite anyone elses, and they can't overwrite yours.

removeTools

Called with an object that has a skills property on it with all the Tools that you want to remove. This will return {"status": true} if successful, {"status": false, "error": MESSAGE} if not.

await chrome.runtime.sendMessage(extensionId, { type: "removeTools", data: asksteve_data });

Some notes about removing Tools:

  • The user will be shown a confirmation dialog where they can choose whether to remove the Tools or not.
  • All Skill Ids and Connection Ids will be prepended with the hostname of your site if it's not already there. This way you can't remove someone else's Tools, and they can't remove yours.

Questions? Need Help?

Ask them in the User Community.