Zapier API documentation
Documentation for Zapier API endpoints
Base URL
The base URL we are using for the current version of our Zapier endpoints is https://api.expertise.ai/v0/users
this will be referred to as {{BASE_URL}}
.
Authentication
This is the endpoint that Zapier calls when a user is attempting to log into Chatsimple.
It lives at {{BASE_URL}}/zapier
.
Request:
const options = {
url: '{{BASE_URL}/zapier',
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-HTML-SNIPPET': html_snippet,
'X-API-KEY': api_key,
},
};
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
return results;
})
html_snippet
contains the user_id
and chatbot_id
.
api_key
is the api_key
given by Chartsimple.
Response:
A successful call will authorize the user:
return {'status': 'success', 'user_id': user_id, 'chatbot_id': chatbot_id}, 200
user_id
and chatbot_id
are returned to make a connection label in Zapier.
Subscribe
This is the endpoint Zapier calls to subscribe to a webhook.
It lives at {{BASE_URL}}/zapier/subscribe
.
Request:
const options = {
url: ' {{BASE_URL}}/zapier/subscribe',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': api_key,
'X-USER-ID': user_id,
'X-CHATBOT-ID': chatbot_id,
'X-HOOKURL': bundle.targetUrl
}
};
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
return results;
});
html_snippet
can be parsed for the user_id
and chatbot_id
.
api_key
is the api_key
given by Chartsimple.
bundle.targetUrl
is the hook URL given by Zapier.
Response:
A successful call will subscribe the user:
const leads_list = leads.map(lead => ({
created_on: lead.created_on,
name: lead.name,
email: lead.email,
phone_number: lead.phone_number,
questions: lead.questions
}));
return leads_list, 200
leads
is the object that holds all the leads of a user.
Unsubscribe
This is the endpoint Zapier calls to unsubscribe to a webhook.
It lives at {{BASE_URL}}/zapier/unsubscribe
.
Request:
const options = {
url: '{{BASE_URL}}/zapier/unsubscribe',
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': api_key,
'X-USER-ID': user_id,
'X-CHATBOT-ID': chatbot_id,
}
};
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
return results;
});
html_snippet
can be parsed for the user_id
and chatbot_id
.
api_key
is the api_key
given by Chartsimple.
Response:
A successful call will unsubscribe the user:
const integration = {
user_id = user_id,
chatbot_id = chatbot_id,
integration_id = integration_id,
integration_type = 'ZAPIER',
api_key = api_key,
target_url = bundle.targetUrl,
}
return integration, 200
Get Leads
This is the endpoint Zapier calls to when the webhook is triggered.
It lives at {{BASE_URL}}/zapier/get_leads
.
Request:
const options = {
url: '{{BASE_URL}}/zapier/get_leads',
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': api_key,
'X-USER-ID': user_id,
'X-CHATBOT-ID': chatbot_id,
}
};
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
return results;
});
html_snippet
can be parsed for the user_id
and chatbot_id
.
api_key
is the api_key
given by Chartsimple.
Response:
A successful call will return the most recent lead:
const lead = {
'created_on': leads.created_on,
'name': leads.name,
'email': leads.email,
'phone_number': leads.phone_number,
'questions': leads.questions,
}
return lead, 200
leads
is the object the most recent lead of a user.
Last updated