diff --git a/README.md b/README.md index f45f01f..5b3cbde 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,15 @@ # 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 diff --git a/src/env.example b/src/env.example new file mode 100644 index 0000000..b1fd72e --- /dev/null +++ b/src/env.example @@ -0,0 +1,4 @@ +CLIENT_ID= +CLIENT_SECRET= +TECHNICIAN_NAMES=First Last, First Last +STATUS_NAMES=Closed,Resolved \ No newline at end of file diff --git a/src/test.js b/src/test.js index 2885144..4013add 100644 --- a/src/test.js +++ b/src/test.js @@ -67,9 +67,9 @@ async function fetchClosedTickets() { fields_required: ["display_id", "subject", "status", "completed_time", "technician"], search_criteria: [ { - field: "status.name", + field: "status.internal_name", condition: "is", - value: "Closed" + values: statuses.map(status => status.trim()) }, { field: "completed_time", @@ -145,7 +145,7 @@ async function main() { 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(); }