An API for triggering contact and company search actions within the GetQuanty, and ClicSight extensions.
Install the package via NPM:
npm install @getquanty/extension-api
The main class for interacting with the extension.
constructor(options: GetquantyApiOptions)
Parameters:
-
options.extensionId
(string, required): The ID of the extension. This is a unique identifier that is assigned to each Chrome extension. You can find theextensionId
by navigating tochrome://extensions/
in your Chrome browser. Ensure that the Developer mode is enabled to view the ID of each installed extension. This ID is needed to reference the specific extension in your application.
Search for a company within the extension.
Parameters:
See the Searching for a Company section.
Return:
A Promise
containing the extension's response or an error.
Search for a contact within the extension.
Parameters:
See the Searching for a Contact section.
Return:
A Promise
containing the extension's response or an error.
The searchCompany
and searchContact
methods return an error if:
- The extension ID is not valid.
- The extension is not accessible.
- Required parameters are missing or invalid.
Create an instance of the GetquantyApi
class by providing the extension ID.
import { GetquantyApi } from '@getquanty/extension-api';
const api = new GetquantyApi({ extensionId: 'extension-id' });
The GetquantyApiOptions interface is available for export for class initialization.
Use the isExtensionInstalled
method to check if the extension is installed. A timeout of 15 seconds is applied to wait for a response before concluding the absence of the extension.
api.isExtensionInstalled()
.then(isInstalled => {
if (isInstalled) {
console.log('The extension is installed.');
} else {
console.log('The extension is not installed.');
}
})
.catch(error => {
console.error('Error checking if the extension is installed:', error);
});
Use the searchCompany
method to send a request to search for information about a company.
The CompanySearchParams interface is available for export for the expected parameters.
-
company
(string, required): The name of the company. -
phone
(string, optional): The company's phone number. -
email
(string, optional): The company's email. -
website
(string, required): The company's website. -
domain
(string, optional): The associated domain. -
siret
(string, optional): The SIRET number of the company. -
siren
(string, optional): The SIREN number of the company. -
company_id
(string, optional): Special case: GetQuanty relies on external data.
api.searchCompany({
company: "My Company",
phone: "+123456789",
website: "https://mycompany.com",
domain: "mycompany.com",
siret: "12345678900012",
siren: "123456789"
}).then(response => {
console.log("Company search result:", response);
}).catch(error => {
console.error("Error:", error);
});
Use the searchContact
method to send a request to search for information about a contact.
The ContactSearchParams interface is available for export for the expected parameters.
-
fullname
(string, optional): The full name of the contact. -
firstname
(string, required): The first name of the contact. -
lastname
(string, required): The last name of the contact. -
company
(string, optional): The associated company. -
linkedin
(string, optional): The LinkedIn profile URL of the contact. -
position
(string, optional): The contact's position or role. -
email
(string, required): The contact's email. -
phone
(string, optional): The contact's phone number. -
contact_id
(string, optional): Special case: GetQuanty relies on external data.
api.searchContact({
fullname: "Jane Doe",
firstname: "Jane",
lastname: "Doe",
company: "Tech Corp",
linkedin: "https://linkedin.com/in/janedoe",
position: "CTO",
email: "jane.doe@techcorp.com",
phone: "+987654321"
}).then(response => {
console.log("Contact search result:", response);
}).catch(error => {
console.error("Error:", error);
});
If you are using the UMD version directly in a browser, add the index.umd.js
file to your project and use the API via the global object GetQuantyExtensionAPI
.
<script src="path/to/index.umd.js"></script>
<script>
const api = new GetQuantyExtensionAPI.GetquantyApi({ extensionId: 'your-extension-id' });
api.searchCompany({
company: "My Company",
website: "https://mycompany.com"
}).then(response => {
console.log("Company search result:", response);
}).catch(error => {
console.error("Error:", error);
});
</script>