This repository was archived on 2026-08-11 and is now read-only.
Last commit to the default branch: 2021-08-25 — 5.0 years before archiving. It was archived as part of an organisation-wide review of dormant repositories. No further changes will be made here.
The code remains available to clone and fork. An organisation owner can restore write access via Settings → General → Danger Zone → Unarchive.
This readme contains development documentation. You should read the Zapier documentation as well.
Clone the repository, then install dependencies:
npm ci
Hint: use npx zapier instead of the zapier installed globally to match the versions of zapier-platform-cli and zapier-platform-core.
The entry point is in index.js. This file contains a master list of all triggers and actions zapier can use.
authentication.js contains the logic for prompting the user for the API key, as well as sending a test request to a protected route in the Detrack API to test if the API Key is valid. In this case, we try to fetch the user's profile.
As per the Zapier documentaiton, triggers and actions can be grouped into resources. Instead of creating individual triggers and actions, we create a resource called Job and put the relevant triggers and actions inside. Currently, there is only one working action for create job.
resources/job/index.js represents a resource schema. It represents what actions are available.
resources/jobs/actions/create.js contains the core logic for the creation of jobs. It sends a POST request to the Detrack API endpoint and throws errors with necessary.
resources/jobs/fields.js is a hardcoded set of fields for a Job.
resources/jobs/get_user_fields is a dynamic field that fetches the user's settings from the Detrack Dashboard merges it with the hardcoded fields.js. The idea is that if the user disabled the field in the Detrack Dashboard, it should be disabled here as well.
resources/jobs/sample.js is just a JSON representation of a sample Job that will be shown to Zapier users when they build their Zap.