Developer API

APIs for enabling your users to quickly add Skills

What is the Ask Steve Developer API?

We have exposed some APIs in the Ask Steve browser extension so that you can programatically add Skills 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);
}

areSkillsUpToDate

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

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

addSkills

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

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

Some notes about adding Skills:

  • The user will be shown a confirmation dialog where they can choose whether to install the Skills 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 Skills won't overwrite anyone elses, and they can't overwrite yours.

removeSkills

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

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

Some notes about removing Skills:

  • The user will be shown a confirmation dialog where they can choose whether to remove the Skills 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 Skills, and they can't remove yours.

Questions? Need Help?

Ask them in the User Community.