Schedule recipient APIs
The schedule recipient APIs allow you to manage and interact with recipients of schedules within your Omni organization.
List schedule recipients
Retrieves the list of recipients for the specified schedule. Successful responses will include the recipients and details about the schedule's destination type.
To retrieve a schedule's full configuration, use the List schedules endpoint.
curl -L 'https://myorg.omniapp.co/api/v1/schedules/e12c43d7-5989-42d5-bad7-f8a4a0aa8be2/recipients' \
-H 'Authorization: Bearer <TOKEN>' \
-H 'Content-Type: application/json'
Parameters
Response
200 OK
Successful requests will return a 200 OK
status and response body specific to the schedule's destination type
:
Email destinations
{
"recipients": [
{
"email": "blobby@blobsrus.com",
"emailOnly": false,
"id": "3e7c4152-cdac-42ce-8749-fe3b81d5d8ab",
"name": "blobby@blobsrus.com"
}
],
"type": "email"
}
SFTP destinations
{
"type": "sftp",
"address": "sftp.example.com",
"port": 22,
"username": "username"
}
Slack destinations
Responses for schedules with Slack destinations will list channel or user recipients:
Channel recipients
{
"type": "slack",
"recipients": [
{
"recipientType": "channel",
"slackId": "C123456789"
}
]
}
User recipients
{
"type": "slack",
"recipients": [
{
"recipientType": "users",
"slackId": "U123456789"
}
]
}
Webhook destinations
{
"type": "webhook",
"url": "https://example.com/webhook"
}
400 Bad Request
Response bodies will be an object similar to the following:
{
"detail": "<errorReason>",
"status": 400
}
Issue | Error detail |
---|---|
Invalid UUID format | Bad Request: scheduleId: Invalid uuid |
Invalid method | Invalid method |
404 Not Found
{
"detail": "<errorReason>",
"status": 404
}
Error | Error detail |
---|---|
Schedule not found | Scheduled task with id {scheduleId} does not exist |
429 Too Many Requests
Results from too many requests in a given time frame. Refer to the Rate limiting documentation for more information.
Add recipients to email schedule
Adds one or more recipients to an existing scheduled email task. Recipients can be specified by email address or user ID.
Limitations
This API only works with schedules with email destinations.
- Add by email
- Add by user ID
- Add multiple recipients
curl -L -X PUT 'https://myorg.omniapp.co/api/v1/schedules/123e4567-e89b-12d3-a456-426614174000/add-recipients' \
-H 'Authorization: Bearer <TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"emails": ["user@example.com"]
}'
curl -L -X PUT 'https://myorg.omniapp.co/api/v1/schedules/123e4567-e89b-12d3-a456-426614174000/add-recipients' \
-H 'Authorization: Bearer <TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"userIds": ["987fcdeb-51a2-43d7-9b56-254415f67890"]
}'
curl -L -X PUT 'https://myorg.omniapp.co/api/v1/schedules/123e4567-e89b-12d3-a456-426614174000/add-recipients' \
-H 'Authorization: Bearer <TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"emails": ["user1@example.com", "user2@example.com"],
"userIds": ["987fcdeb-51a2-43d7-9b56-254415f67890", "abcdef12-3456-7890-abcd-ef1234567890"]
}'
Parameters
Response
200 OK
Successful requests will return a 200 OK
status and a response body similar to the following:
{
"addedRecipientsCount": 2,
"success": true
}
400 Bad Request
{
"detail": "<errorReason>",
"status": 400
}
Error | Error detail |
---|---|
Invalid UUID format | userIds: Invalid uuid |
Invalid email format | emails: Invalid email address |
Empty request body | Please provide either valid email addresses, valid user IDs, or both |
No recipients provided | - At least one recipient must be provided - {parameter}: Array must contain at least 1 element(s) |
Invalid members | Invalid recipient(s): The following members do not exist or do not have access to this organization: {userId} |
Unsupported destination type | Cannot add recipients to destination type {destinationType} |
404 Not Found
{
"detail": "<errorReason>",
"status": 404
}
Error | Error detail |
---|---|
Schedule not found | Scheduled task with id {scheduleId} does not exist |
429 Too Many Requests
Results from too many requests in a given time frame. Refer to the Rate limiting documentation for more information.
Remove recipients from email schedule
Removes one or more recipients from an existing scheduled email task. Recipients can be specified by email address or user ID.
Limitations
This API only works with schedules with email destinations.
- Remove by email
- Remove by user ID
- Remove multiple recipients
curl -L -X PUT 'https://myorg.omniapp.co/api/v1/schedules/123e4567-e89b-12d3-a456-426614174000/remove-recipients' \
-H 'Authorization: Bearer <TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"emails": ["user@example.com"]
}'
curl -L -X PUT 'https://myorg.omniapp.co/api/v1/schedules/123e4567-e89b-12d3-a456-426614174000/remove-recipients' \
-H 'Authorization: Bearer <TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"userIds": ["987fcdeb-51a2-43d7-9b56-254415f67890"]
}'
curl -L -X PUT 'https://myorg.omniapp.co/api/v1/schedules/123e4567-e89b-12d3-a456-426614174000/remove-recipients' \
-H 'Authorization: Bearer <TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"emails": ["user1@example.com", "user2@example.com"],
"userIds": ["987fcdeb-51a2-43d7-9b56-254415f67890", "abcdef12-3456-7890-abcd-ef1234567890"]
}'
Parameters
Response
200 OK
Successful requests will return a 200 OK
status and a response body similar to the following:
{
"removedRecipientsCount": 2,
"success": true
}
400 Bad Request
{
"detail": "<errorReason>",
"status": 400
}
Error | Error detail |
---|---|
Invalid UUID format | Bad Request: userIds: Invalid uuid |
Invalid email format | Bad Request: emails: Invalid email address |
Empty request body | Please provide either valid email addresses, valid user IDs, or both |
No recipients provided | - At least one recipient must be provided - {parameter}: Array must contain at least 1 element(s) |
Invalid members | Invalid recipient(s): The following members do not exist or do not have access to this organization: {userId} |
Unsupported destination type | Cannot change recipients on a scheduled task destination of type {destinationType} |
404 Not Found
{
"detail": "<errorReason>",
"status": 404
}
Error | Error detail |
---|---|
Schedule not found | Scheduled task with id {scheduleId} does not exist |
429 Too Many Requests
Results from too many requests in a given time frame. Refer to the Rate limiting documentation for more information.
Create or update an email-only user
Creates or updates an email-only user. An email-only user is a recipient of a delivery that isn't associated with an Omni account.
If Omni matches the provided email to an existing email-only user, the user will be updated according to the userAttributes
in the request body.
Need to include multiple email-only users? Use the Create or update multiple email-only users endpoint.
- Basic request
- Set user attributes
- Unset user attribute
curl -X POST'https://myorg.omniapp.co/api/v1/users/email-only' \
--H 'Content-Type: application/json' \
--H 'Authorization: Bearer <TOKEN>' \
--data '{
"email": "iamagoodblob@myorg.co"
}'
When providing user attributes, note that:
omni_user_timezone
is the only supported system attribute- Values must match the user attribute's specified
type
. For example,number
attribute values must be numbers such as1
,10
, etc. - Multi-value attributes should be provided using arrays. For example:
["US","EU"]
or[1, 10]
curl -X POST'https://myorg.omniapp.co/api/v1/users/email-only' \
--H 'Content-Type: application/json' \
--H 'Authorization: Bearer <TOKEN>' \
--data '{
"email": "iamagoodblob@myorg.co",
"userAttributes": {
"region": ["US","EU"],
"omni_user_timezone": "America/New_York",
"is_admin": 0,
"is_sales_team": 1
}
}'
Unset user attributes by providing:
null
values""
- Empty strings for string attributes[]
- Empty arrays for multi-value attributes
curl -X POST'https://myorg.omniapp.co/api/v1/users/email-only' \
--H 'Content-Type: application/json' \
--H 'Authorization: Bearer <TOKEN>' \
--data '{
"email": "iamagoodblob@myorg.co",
"userAttributes": {
"is_admin": null,
"is_sales_team": "",
"region": []
}
}'
Parameters
Response
200 OK
Successful requests will return a 200 OK
status and a response body similar to the following:
{
"email": "iamagoodblob@myorg.co",
"userId": "9e8719d9-276a-4964-9395-a493189a247c"
}
400 Bad Request
{
"detail": "<errorReason>",
"status": 400
}
Error | Error detail |
---|---|
Invalid JSON in request body | Invalid JSON |
Missing email parameter | email: email is required |
email value isn't a valid email address | email: Invalid email address |
User attribute does not exist | The provided user attributes: \"<attribute>\" do not match the names of existing user attributes. |
User attribute type mismatch | User Attribute <attribute> is type number, but passed-in value <value> is not a number. |
Invalid omni_user_timezone value | The timezone <invalidTimezone> is not supported. Please see the connection page or user profile page for the list of valid timezones. Use e.g. \"America/New_York\" instead of \"EST\" |
Multiple values not provided as array | User Attribute <attribute> has multiple values enabled, but the passed-in value is not an array. If passing a single value for a user attribute with multiple values enabled, please wrap the value in an array [x]. |
429 Too Many Requests
Results from too many requests in a given time frame. Refer to the Rate limiting documentation for more information.
Create or update multiple email-only users
Creates or updates up to 20 email-only users. An email-only user is a recipient of a delivery that isn't associated with an Omni account.
If Omni matches a provided email to an existing email-only user, the user will be updated according to the userAttributes
in the request body.
- Basic request
- Set user attributes
- Unset user attribute
curl -X POST'https://myorg.omniapp.co/api/v1/users/email-only/bulk' \
--H 'Content-Type: application/json' \
--H 'Authorization: Bearer <TOKEN>' \
--data '{
"users":[
{
"email":"iamagoodblob@myorg.co"
},
{
"email":"blobmanager@myorg.co"
}
]
}'
When providing user attributes, note that:
omni_user_timezone
is the only supported system attribute- Values must match the user attribute's specified
type
. For example,number
attribute values must be numbers such as1
,10
, etc. - Multi-value attributes should be provided using arrays. For example:
["US","EU"]
or[1, 10]
curl -L POST 'https://myorg.omniapp.co/api/v1/users/email-only/bulk' \
--H 'Content-Type: application/json' \
--H 'Authorization: Bearer <TOKEN>' \
--data '{
"users":[
{
"email":"iamagoodblob@myorg.co",
"userAttributes":{
"region":[
"US",
"EU"
],
"omni_user_timezone":"America/New_York",
"is_admin":0,
"is_sales_team":1
}
},
{
"email":"blobmanager@myorg.co",
"userAttributes":{
"region":[
"US"
],
"omni_user_timezone":"America/New_York",
"is_admin":1,
"is_sales_team":0
}
}
]
}'
Unset user attributes by providing:
null
values""
- Empty strings for string attributes[]
- Empty arrays for multi-value attributes
curl -X POST'https://myorg.omniapp.co/api/v1/users/email-only/bulk' \
--H 'Content-Type: application/json' \
--H 'Authorization: Bearer <TOKEN>' \
--data '{
"users":[
{
"email":"iamagoodblob@myorg.co",
"userAttributes":{
"region":[],
"omni_user_timezone":"",
"is_admin":null
}
}
]
}'
Parameters
Response
200 OK
Successful requests will return a 200 OK
status and a response body similar to the following:
{
"results": [
{
"email": "iamagoodblob@myorg.co",
"userId": "1e23dadc-961b-4a21-b36b-17168130fc3f"
},
{
"email": "blobmanager@myorg.co",
"userId": "e9d19f71-0b59-4f8e-8343-a75d30576d28"
}
]
}
400 Bad Request
{
"detail": "<errorReason>",
"status": 400
}
Error | Error detail |
---|---|
Invalid JSON in request body | Invalid JSON |
Maximum users exceeded | users: Maximum of 20 users can be processed in a single request |
Missing users parameter | users: users is required |
Missing email parameter | email: email is required |
email value isn't a valid email address | email: Invalid email address |
User attribute does not exist | The provided user attributes: \"<attribute>\" do not match the names of existing user attributes. |
User attribute type mismatch | User Attribute <attribute> is type number, but passed-in value <value> is not a number. |
Invalid omni_user_timezone value | The timezone <invalidTimezone> is not supported. Please see the connection page or user profile page for the list of valid timezones. Use e.g. \"America/New_York\" instead of \"EST\" |
Multiple values not provided as array | User Attribute <attribute> has multiple values enabled, but the passed-in value is not an array. If passing a single value for a user attribute with multiple values enabled, please wrap the value in an array [x]. |
429 Too Many Requests
Results from too many requests in a given time frame. Refer to the Rate limiting documentation for more information.