On-Call API › My notifications
Add a notification method
Adds a way to notify the caller. target is a phone number in international
form (+ and the country code) for voice and sms, an address for
email, and not needed for push (the caller's signed-in devices are used).
SMS may not be available. enabled defaults to true.
These are the caller's own, across every organization they belong to. Meant for a person; with an organization API key the key itself is the caller.
Permission: none — any valid API key or signed-in member of the organization.
Authorization
Request body required
channelNotificationChannel requiredtargetstringpriorityintegerenabledbooleanquiet_startstringquiet_endstring
Responses
201
The preference.
dataNotificationPreference requiredShow NotificationPreference properties
idstringorg_idstringThe organization it was created from.user_idstringchannelNotificationChanneltargetstringPhone number, email address, or empty for push.priorityinteger0 is tried first.enabledbooleanquiet_startstringStored for older clients; no longer used. Use the notification schedule.quiet_endstringStored for older clients; no longer used.created_atstring (date-time)updated_atstring (date-time)
successboolean required
400
The body is not JSON (INVALID_BODY), or it was refused (VALIDATION_ERROR, the message says why): unknown channel, missing or malformed target, SMS unavailable, or the same channel and target already exist.
errorobject requiredcodestring requiredMachine-readable code. Branch on this.messagestring requiredHuman-readable explanation.
401
No API key was sent, or it is unknown, revoked or expired (UNAUTHORIZED).
errorobject requiredcodestring requiredMachine-readable code. Branch on this.messagestring requiredHuman-readable explanation.
429
Too many requests (RATE_LIMITED). Wait Retry-After seconds.
Retry-AfterintegerSeconds to wait.
errorobject requiredcodestring requiredMachine-readable code. Branch on this.messagestring requiredHuman-readable explanation.
500
Something went wrong on EvoHub's side (INTERNAL_ERROR). Retry later.
errorobject requiredcodestring requiredMachine-readable code. Branch on this.messagestring requiredHuman-readable explanation.
Example request
curl -X POST 'https://evohub.io/api/v1/notification-preferences' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"target": "+905321234567",
"channel": "voice",
"priority": 0
}'