Preferences

All available operations for sending and manipulating preferences


List all preferences #

This endpoint returns information about all preferences set for a specific user.

HTTP Request #

GET https://api.cord.com/v1/users/<USER_ID>/preferences
Copy

Request Body #

This REST endpoint has no request body.

Response #

The response is a JSON array of objects with the following fields:


notification_channels
NotificationPreferences
notification_channels controls how users get notified about Cord activity.

This is an object with the following fields:


sendViaSlack
boolean
Whether notifications should be sent via slack.

sendViaEmail
boolean
Whether notifications should be sent via email.

Update preferences #

This endpoint updates preferences for a user.

HTTP Request #

PUT https://api.cord.com/v1/<USER_ID>/preferences
Copy

Request Body #


key
required
"notification_channels"
The preference key. notification_channels controls how users get notified about Cord activity.

value
required
Partial<NotificationPreferences>
The updated preference value. This will update only the keys that are passed along. For example, to disable Slack notification, but leave email untouched, you can use this value:
{
   "value": { "sendViaSlack": "false" },
}

This is an object with the following fields:


sendViaSlack
optional
boolean
Whether notifications should be sent via slack.

sendViaEmail
optional
boolean
Whether notifications should be sent via email.

Example Request #

In this example, suppose a user with the ID 123 exists. If you want to disable email notifications for this user, you can send this request:

curl "https://api.cord.com/v1/123/preferences" \
  -X PUT \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
    "key": "notification_channels",
    "value": {"sendViaSlack": false}
  }'
Copy

If the request succeeds, the response will be:

{
    "success": true,
    "message": "✅ You successfully updated user 123 preferences",
}
Copy

If the request does not succeed, the response will instead contain anerror and message explaining what went wrong:

{
  "error": "<ERROR_CODE>",
  "message": "An explanation of the error code."
}
Copy

Ask Cordy