Saltar al contendio prinicipal

Schedules Data Model

Advertencia

Esta página aún no se encuentra traducida al español.

COTSchedule

Description

The Scheduler creates schedules or automated scheduled routines, and their settings are stored in the COTSchedule data model. Scheduled routines can be programmed to run once or recurrently. For example, you can check if everybody has completed their tasks at the end of each week.

JSON Sample

        {
"_id": "618a808163a6cf3425f886cd", //ObjectId<COTSchedule>
"body": { //COTParametrizedBot
"start": "send_message",
"maxIterations": 1,
"stages": [
{
"key": "send_message",
"name": "PBMessage",
"data": {
"content": "Hi, team! This a recurrent message sent to the channel every Monday at 10:00 AM.",
"contentType": "text/plain",
"sentBy": "618a808634a3abddd5f71385", //ObjectId<COTUser>
"channelIds": [
"618a80a4c004dced3105ecfe" //ObjectId<COTChannel>
]
},
"customNetworkRequest": [],
"next": {
"DEFAULT": ""
}
}
],
"version": "v2"
},
"code": "remember_producto",
"company": "618a807795079af3748ba9cb", //ObjectId<COTCompany>
"createdAt": "2020-04-01T19:44:15.439Z",
"cron": "0 10 * * 1",
"cronTimeZone": "America/Santiago",
"endDate": null,
"hooks": [],
"isSystem": false,
"killMeTime": null,
"modifiedAt": "2021-11-01T13:00:00.161Z",
"owner": "AdminSchedules",
"runVersion": "v2",
"startedAt": "2020-08-23T07:13:14.441Z",
"status": "idle",
"time": "2020-04-06T11:00:00.000Z",
"timeoutMinutes": 60,
"user": "618a808634a3abddd5f71385", //ObjectId<COTUser>
}

Fields

FieldDescriptionTypeNote
_idSystem generated scheduler ID.ObjectId<COTSchedule>
bodyContains the scheduled routine.COTParametrizedBot
codeThe schedule's name code.Maximum 60 characters; only lowercase letters, numbers, and underscores allowed; must be unique.
companyThe ID of the company the schedule is found in.ObjectId<COTCompany>
createdAtIndicates the date the scheduled routine was created.ISODateYYYY-MM-DDTHH:mm:ss.SSSZ
cronScheduled routine recurrence indicated in cron format, e.g., 00 30 08 * * 1,4,5stringCron format :
Seconds: 0-59
Minutes: 0-59
Hours: 0-23
Day of Month: 1-31
Months: 0-11 (Jan-Dec)
Day of Week: 0-6 (Sun-Sat)
cronTimeZoneIndicates the time zone using TZ database name.stringDefault: America/Santiago
endDateIndicates the end date of the scheduled routine.ISODateYYYY-MM-DDTHH:mm:ss.SSSZ
hooksMakes an API request when triggered by an event.object[ ]
hooks[index].eventIndicates the type of event.stringEnum: ["on-error", "on-success", "on-finish", "on-start"]
hooks[index].apiIndicates the source type of the API request.stringEnum: ["cotalker", "url"]
hooks[index].urlIndicates the API URL path.string
isSystemIf true, the scheduled routine cannot be changed, even by admins.boolean
killMeTimeIndicates execution time deadline. Depends on timeoutMinutes.ISODateWIP
modifiedAtIndicates the last time the scheduled routine was modified.ISODateYYYY-MM-DDTHH:mm:ss.SSSZ
ownerSpecifies ownership.stringDefault: AdminSchedules
runVersionIndicates the scheduler's version.stringDefault: v2
startedAtTime when the routine first ran.ISODateYYYY-MM-DDTHH:mm:ss.SSSZ
statusIndicates the scheduled automation's status.stringEnum: ["pending", "done", "running", "canceled", "error"]
timeIndicates the start date of the scheduled routine.ISODateYYYY-MM-DDTHH:mm:ss.SSSZ
timeoutMinutesNumber of minutes before timeout.number
userThe ID of the user that created the scheduled routine.ObjectId<COTUser>

Deprecated

FieldDescriptionTypeNote
execPathDefault:
./../scripts/parametrizedBots/pb.controller.js
stringDEPRECATED
__vVersion number.numberDEPRECATED

Additional Resources

Help