Skip to main content

Out of Office

With these APIs your own applications can turn the out-of-office setting of an employee on and off, and read it.

All three APIs:

  • Must be authenticated with HMAC Authentication. See the Authentication document.
  • Use HTTP POST with Content-Type application/json.
  • Identify the employee with either userId (Diyalog user id) or staffId (the employee number in your organization). If both are sent, userId is used. If neither is sent, the request fails.

Changes made with staffId are written to the audit log.

POST v1/application/enableoutofoffice#

Turns on out of office for an employee. Messages to the employee can be forwarded to other employees while it is on.

API URI: https://DIYALOG-SERVER-API-ENDPOINT/v1/application/enableoutofoffice

Request body#

FieldTypeRequiredDescription
userIdintOne of userId / staffIdDiyalog user id of the employee
staffIdstringOne of userId / staffIdEmployee number of the employee
outOfOfficeMessagestringYesOut-of-office message shown to people who write to the employee
beginDatelongNoStart time in epoch milliseconds. Omitted: starts immediately.
endDatelongNoEnd time in epoch milliseconds. Omitted: no end time.
forwardToUserIdsint[]NoDiyalog user ids of the employees to forward to
forwardToStaffIdsstring[]NoEmployee numbers of the employees to forward to. Used only when forwardToUserIds is not sent.

Every forward target must exist; otherwise the request fails.

Example request body#

{
"staffId": "A12345",
"outOfOfficeMessage": "I am on leave until Monday. Your messages are forwarded to my team.",
"beginDate": 1767225600000,
"endDate": 1767830400000,
"forwardToStaffIds": ["A23456", "A34567"]
}

Response#

FieldTypeDescription
isSuccessbooleantrue when out of office was turned on
messagestringResult text, e.g. Out of office enabled
errorstringError text; present only on failure
seqintSequence number of the user update produced by the change

Example response body#

{
"isSuccess": true,
"message": "Out of office enabled",
"seq": 1042
}

POST v1/application/disableoutofoffice#

Turns off out of office for an employee.

API URI: https://DIYALOG-SERVER-API-ENDPOINT/v1/application/disableoutofoffice

Request body#

FieldTypeRequiredDescription
userIdintOne of userId / staffIdDiyalog user id of the employee
staffIdstringOne of userId / staffIdEmployee number of the employee

Example request body#

{
"staffId": "A12345"
}

Response#

Same fields as enableoutofoffice.

{
"isSuccess": true,
"message": "Out of office disabled",
"seq": 1043
}

POST v1/application/getuseroutofofficeinfo#

Returns the current out-of-office setting of an employee.

API URI: https://DIYALOG-SERVER-API-ENDPOINT/v1/application/getuseroutofofficeinfo

Request body#

FieldTypeRequiredDescription
userIdintOne of userId / staffIdDiyalog user id of the employee
staffIdstringOne of userId / staffIdEmployee number of the employee

Response#

FieldTypeDescription
enabledbooleanWhether out of office is on
beginDatelongStart time in epoch milliseconds; absent when no start time was set
endDatelongEnd time in epoch milliseconds; absent when no end time was set
forwardedUserIdsint[]Diyalog user ids messages are forwarded to
forwardedStaffIdsstring[]Employee numbers of the same employees
outOfOfficeMessagestringThe out-of-office message

Example response body#

{
"enabled": true,
"beginDate": 1767225600000,
"endDate": 1767830400000,
"forwardedUserIds": [2001, 2002],
"forwardedStaffIds": ["A23456", "A34567"],
"outOfOfficeMessage": "I am on leave until Monday. Your messages are forwarded to my team."
}

Errors#

HTTP statusWhen
400The request body is not valid JSON for this API. The error text is returned as plain text.
500The operation failed, e.g. no userId or staffId was given, the employee or a forward target was not found. The error text is returned as plain text.

If the request fails HMAC validation, the following errors are returned as plain text. See Authentication.

HTTP statusMessageDescription
400Required headers not foundOne or more of the x-dlg-date, x-dlg-requester-userid or x-dlg-authorization headers are missing.
400Authorization failed due to data format not validThe x-dlg-authorization value after DLGA is not in the AccessKeyId:Signature form.
400Date format is invalid. EEE, dd MMM yyyy HH:mm:ss Z is requiedThe x-dlg-date value cannot be parsed in this format. The message text is returned as shown, including its spelling.
401Authorization failedThe x-dlg-authorization header does not contain DLGA , the AccessKeyId is unknown, or the signature is not correct.
401You have no permission on this operation. Contact your admin.The signature is correct, but your access key has no application permission.
403Request time may not be correct.The x-dlg-date value differs from the server time by more than 15 minutes.