Browse Platform API
Platform APIEnterprise

Create a timer task

Copy

Schedule a task that invokes a configured business handler at the specified time.

HTTP request

POST {API_ADDRESS}/timer/create_timer_task

Request example

curl --request POST "${API_ADDRESS}/timer/create_timer_task" --header "Content-Type: application/json" --header "operationID: ${OPERATION_ID}" --header "token: ${TOKEN}" --data-raw '{"taskName":"Reminder","taskCategory":"reminder","executeAt":1719800000000,"executeBefore":1719800060000,"maxRetry":1,"callbackConfig":{"callbackMethod":"openim-http","callbackPayload":"{\"event\":\"reminder\"}"},"userID":"user_001","dedupKey":"reminder_001"}'

Request body

ParameterRequiredTypeDescription
taskNameYesstringTask name.
taskCategoryYesstringBusiness-defined category.
executeAtYesintScheduled Unix time in milliseconds.
executeBeforeYesintLatest permitted execution time in milliseconds.
maxRetryYesintMaximum retry count.
callbackConfigYesTimerTaskCallbackConfigSee TimerTaskCallbackConfig.
userIDYesstringAssociated OpenIM user ID.
dedupKeyYesstringStable business idempotency key.

Response

data.task contains the created TimerTask.

Errors

See Error codes.

Permissions and limits

  • Available only in OpenIM Enterprise.
  • Reuse dedupKey when retrying the same logical creation request.