import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
servicetitan: {
type: "app",
app: "servicetitan",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://api${this.servicetitan.$auth.environment}servicetitan.io/settings/v2/tenant/${this.servicetitan.$auth.tenant_id}/employees`,
headers: {
Authorization: `Bearer ${this.servicetitan.$auth.oauth_access_token}`,
"st-app-key": `${this.servicetitan.$auth.client_id}`,
},
})
},
})
ServiceTitan uses OAuth authentication. When you connect your ServiceTitan account, Pipedream will open a popup window where you can sign into ServiceTitan and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any ServiceTitan API.
Pipedream requests the following authorization scopes when you connect your account:
POST
https://auth{{custom_fields.environment}}servicetitan.io/connect/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{custom_fields.client_id}}
&
client_secret={{custom_fields.client_secret}}
&
grant_type=client_credentials
POST
https://auth{{custom_fields.environment}}servicetitan.io/connect/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{custom_fields.client_id}}
&
client_secret={{custom_fields.client_secret}}
&
grant_type=client_credentials