Installation API
APIs to programmatically add Agents
What is the Ask Steve Installation API?
We have exposed some APIs in the Ask Steve browser extension so that you can programatically add Agents 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
The extensionId is gldebcpkoojijledacjeboaehblhfbjg
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);
}
areAgentsUpToDate
Called with an object that has a skills
property on it with all the Agents that you want to compare. If any of the Agents don't exist or have been modified, this will return {"status": false}
, otherwise it will return {"status": true}
try {
// are the Agents already installed and up to date?
const response = await chrome.runtime.sendMessage(extensionId, {type: "areAgentsUpToDate", data: asksteve_data});
if (!chrome.runtime.lastError && response.status) {
console.log('Agents are up to date');
}
else {
console.log('Agents are not up to date');
}
}
catch (error) {
console.log('Extension unreachable', error);
}
addAgents
Called with an object that has a skills
property on it with all the Agents that you want to add. This will return {"status": true}
if successful, {"status": false, "error": MESSAGE}
if not.
await chrome.runtime.sendMessage(extensionId, { type: "addAgents", data: asksteve_data });
Some notes about adding Agents:
- The user will be shown a confirmation dialog where they can choose whether to install the Agents 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 Agents won't overwrite anyone elses, and they can't overwrite yours.
removeAgents
Called with an object that has a skills
property on it with all the Agents that you want to remove. This will return {"status": true}
if successful, {"status": false, "error": MESSAGE}
if not.
await chrome.runtime.sendMessage(extensionId, { type: "removeAgents", data: asksteve_data });
Some notes about removing Agents:
- The user will be shown a confirmation dialog where they can choose whether to remove the Agents 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 Agents, and they can't remove yours.
Questions? Need Help?
Ask them in the User Community.