Skip to main content

User Presence

Manage and monitor user presence status and availability.

Overview​

User presence indicates a user's current availability status. Presence status is visible to other users and affects call routing behavior.

Presence Status​

StatusDescriptionAvailability
availableUser is available and can receive callsWill receive calls
busyUser is in a call or meetingMay not receive calls
awayUser is temporarily awayVoicemail or forwarding
dndDo Not Disturb - user does not want callsNo calls, voicemail only
offlineUser is logged outNo calls
invisibleUser appears offline but is availableHidden status

Endpoints​

GET /v1/accounts/{accountId}/users/{userId}/presence
POST /v1/accounts/{accountId}/users/{userId}/presence
GET /v1/accounts/{accountId}/users/presence

Get User Presence​

Retrieve the current presence status of a user.

Endpoint​

GET https://api.audian.com:8443/v2/accounts/{accountId}/users/{userId}/presence

Example​

curl -X GET https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456/presence \
-H "X-Auth-Token: YOUR_API_TOKEN"

Response​

{
"userId": "user_123456",
"status": "available",
"customMessage": "In office, working on client proposal",
"lastUpdate": "2023-10-20T10:15:00Z",
"activeCall": false,
"activeMeeting": false,
"doNotDisturb": {
"enabled": false,
"reason": null,
"until": null
},
"callForwarding": {
"enabled": false,
"destination": null
}
}

Set User Presence​

Update a user's presence status.

Endpoint​

POST https://api.audian.com:8443/v2/accounts/{accountId}/users/{userId}/presence

Request Body​

ParameterTypeRequiredDescription
statusstringYesPresence status
messagestringNoCustom status message
durationintegerNoDuration in seconds

Example​

curl -X POST https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456/presence \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"status": "away",
"message": "In a meeting until 2 PM",
"duration": 3600
}'

Response​

{
"userId": "user_123456",
"status": "away",
"customMessage": "In a meeting until 2 PM",
"lastUpdate": "2023-10-20T10:30:00Z",
"expiresAt": "2023-10-20T11:30:00Z"
}

Bulk Presence Status​

Get presence for multiple users.

Endpoint​

GET https://api.audian.com:8443/v2/accounts/{accountId}/users/presence

Query Parameters​

ParameterTypeDescription
userIdsstringComma-separated user IDs
statusstringFilter by status
limitintegerNumber of results

Example​

curl -X GET "https://api.audian.com:8443/v2/accounts/acc_1234567890/users/presence?userIds=user_123456,user_789012&status=available" \
-H "X-Auth-Token: YOUR_API_TOKEN"

Response​

{
"data": [
{
"userId": "user_123456",
"status": "available",
"customMessage": "In office",
"lastUpdate": "2023-10-20T10:15:00Z"
},
{
"userId": "user_789012",
"status": "dnd",
"customMessage": "Do not disturb",
"lastUpdate": "2023-10-20T10:00:00Z"
}
]
}

Do Not Disturb (DND)​

Enable DND​

curl -X POST https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456/dnd \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"enabled": true,
"reason": "Busy",
"duration": 3600
}'

Response​

{
"userId": "user_123456",
"dnd": {
"enabled": true,
"reason": "Busy",
"startTime": "2023-10-20T10:30:00Z",
"endTime": "2023-10-20T11:30:00Z",
"sendToVoicemail": true
}
}

Disable DND​

curl -X DELETE https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456/dnd \
-H "X-Auth-Token: YOUR_API_TOKEN"

Call Forwarding​

Set Call Forwarding​

curl -X POST https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456/call-forwarding \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"enabled": true,
"destination": "+1-555-9999",
"destinationType": "external",
"noAnswerAfter": 20
}'

Response​

{
"userId": "user_123456",
"callForwarding": {
"enabled": true,
"destination": "+1-555-9999",
"destinationType": "external",
"noAnswerAfter": 20,
"lastUpdate": "2023-10-20T10:35:00Z"
}
}

Disable Call Forwarding​

curl -X DELETE https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456/call-forwarding \
-H "X-Auth-Token: YOUR_API_TOKEN"

JavaScript/Node.js Example​

const axios = require('axios');

async function setUserPresence(accountId, userId, status, message) {
try {
const response = await axios.post(
`https://api.audian.com:8443/v2/accounts/${accountId}/users/${userId}/presence`,
{
status: status,
message: message,
duration: 3600
},
{
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN'
}
}
);

console.log('Presence updated:', response.data);
return response.data;
} catch (error) {
console.error('Error:', error.response.data);
}
}

async function getUserPresence(accountId, userId) {
try {
const response = await axios.get(
`https://api.audian.com:8443/v2/accounts/${accountId}/users/${userId}/presence`,
{
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN'
}
}
);

console.log('User presence:', response.data);
return response.data;
} catch (error) {
console.error('Error:', error.response.data);
}
}

// Usage
setUserPresence('acc_1234567890', 'user_123456', 'away', 'In a meeting');
getUserPresence('acc_1234567890', 'user_123456');

Python Example​

import requests

def set_user_presence(account_id, user_id, status, message=None):
url = f'https://api.audian.com:8443/v2/accounts/{account_id}/users/{user_id}/presence'
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN'
}

data = {
'status': status,
'duration': 3600
}
if message:
data['message'] = message

response = requests.post(url, headers=headers, json=data)

if response.status_code == 200:
print('Presence updated:', response.json())
return response.json()
else:
print('Error:', response.json())

def get_user_presence(account_id, user_id):
url = f'https://api.audian.com:8443/v2/accounts/{account_id}/users/{user_id}/presence'
headers = {
'Authorization': 'Bearer YOUR_API_TOKEN'
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
print('User presence:', response.json())
return response.json()
else:
print('Error:', response.json())

# Usage
set_user_presence('acc_1234567890', 'user_123456', 'away', 'In a meeting')
get_user_presence('acc_1234567890', 'user_123456')

Presence Events​

Subscribe to presence change events:

curl -X POST https://api.audian.com:8443/v2/accounts/acc_1234567890/webhooks \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"url": "https://yourserver.com/webhooks/presence",
"events": ["user.presence.changed"]
}'

Webhook Event Example​

{
"event": "user.presence.changed",
"timestamp": "2023-10-20T10:35:00Z",
"data": {
"userId": "user_123456",
"status": "away",
"message": "In a meeting",
"previousStatus": "available"
}
}

Presence Rules​

Auto-Update Rules​

Configure automatic presence updates:

curl -X POST https://api.audian.com:8443/v2/accounts/acc_1234567890/users/user_123456/presence-rules \
-H "Content-Type: application/json" \
-H "X-Auth-Token: YOUR_API_TOKEN" \
-d '{
"rules": [
{
"condition": "activeCall",
"setStatus": "busy"
},
{
"condition": "activeMeeting",
"setStatus": "busy"
},
{
"condition": "afterHours",
"setStatus": "away",
"message": "Offline"
}
]
}'

Best Practices​

  1. Auto-Update: Enable automatic presence updates during calls
  2. Messages: Use clear, helpful status messages
  3. Timing: Set appropriate duration for temporary statuses
  4. Forwarding: Use call forwarding when away
  5. DND: Use DND during focused work
  6. Consistency: Keep presence synchronized across devices

Status Codes​

CodeDescription
200Success
201Created
400Bad request
401Unauthorized
404User not found
500Server error