Reads all statuses and users now also updated the repo to contain a simple setup guide and an example .env

This commit is contained in:
Isaac 2026-07-24 14:06:52 -04:00
parent 7fd07c322b
commit 9cf1c6ac37
3 changed files with 17 additions and 4 deletions

View File

@ -1,6 +1,15 @@
# sdp-request-watcher # sdp-request-watcher
A locally run JS app to monitor for request closures using Zoho's SDP Cloud API.
# Setup
env.example contains the setup for the env requires a Non-Browser Application key from https://api-console.zoho.com/add
Technicians and Statuses are checked in the .env file
I resolved the issue with it only finding closed tickets so it should now find resolved and closed I havent tested with others but will
The technician field can have spaces after the comma however the statuses can not. There can be no spaces before the status or it wont work properly.
## Reference Materials ## Reference Materials

4
src/env.example Normal file
View File

@ -0,0 +1,4 @@
CLIENT_ID=
CLIENT_SECRET=
TECHNICIAN_NAMES=First Last, First Last
STATUS_NAMES=Closed,Resolved

View File

@ -67,9 +67,9 @@ async function fetchClosedTickets() {
fields_required: ["display_id", "subject", "status", "completed_time", "technician"], fields_required: ["display_id", "subject", "status", "completed_time", "technician"],
search_criteria: [ search_criteria: [
{ {
field: "status.name", field: "status.internal_name",
condition: "is", condition: "is",
value: "Closed" values: statuses.map(status => status.trim())
}, },
{ {
field: "completed_time", field: "completed_time",
@ -145,7 +145,7 @@ async function main() {
await pollForToken(deviceData.device_code, deviceData.interval); await pollForToken(deviceData.device_code, deviceData.interval);
setInterval(fetchClosedTickets, 600000); //runs every 10 mins setInterval(fetchClosedTickets, 1 * 60 * 1000); //Only change the first number the first is the amount of minutes between each run
fetchClosedTickets(); fetchClosedTickets();
} }