This API can be used to compose and send an email activity. Only one outbound email activity can be created and sent at a time.
If the setting "Enable secure messaging" is enabled, and the value of the setting "Types of emails agents are allowed to send" is "Only secure emails", the created activity will be a secure activity.
As part of completing this API request:
Method | URL | Description |
---|---|---|
POST | /ws/v12/interaction/activity/send | Compose and send email activity. |
Authentication is required. The client must be logged in to call this API. Each API request must contain X-egain-session request header returned by Login API.
All of the following are required:
The logged in user must have the following licenses:
Name | Description | Allowed values | Default value |
---|---|---|---|
X-egain-session | Session ID obtained from Login API response header | N/A | N/A |
Content-Type | Media type sent by the client. | application/xml or application/json or multipart/form-data | N/A |
Accept | Content type accepted by the client. | application/xml or application/json | N/A |
Accept-Language | Language locale accepted by client (used for locale specific fields in resource representation and in error responses) | Supported 'Accept-Language' header codes | default system language |
The request body is mandatory. The request body can be in one of the below two formats:
Name | Description |
---|---|
department.name | Name of the department in which the activity should be created. |
type.value | Must be "email". |
type.subtype.value | Must be "compose". |
payload.email.emailAddresses.to | Specifies the customer's email address. This must be a single email address. If "Customer departmentalization" setting is enabled, this API will try to find the customer in the department of the activity, otherwise it will try to find the customer across the application. If a customer with this email address does not exist:
|
subject or attachments or content | Must have at least one of subject, attachments, or content. |
Name | Description |
---|---|
payload.email.emailAddresses.from | Must be provided if the setting "Enable secure messaging" is disabled. If provided:
|
case.id | If case.id is not provided, the application will create a new case for the activity. If provided, this case must exist in the system and the activity will be associated to the case. |
queue.name | The queue with which the created activity will be associated. Must be a queue in the department of the activity. The queue must be active. This is allowed only if the setting "Allow agent to associate a new outbound activity with a queue" is enabled in the department of the activity. |
priority | Must be a value between 1 and 7. |
dueDate | Must be a future date. Refer supported date format here. |
subject | Must not exceed 245 characters. Subject can contain macros in the format (two grave accents followed by the macro name): ``<macro_name>. Eg: ``activity_id |
attachments | If attachments are provided, file type of any attachment must not be blocked in the application. This element is not allowed for multipart/form-data requests. To send attachments for multipart/form-data requests refer Example 4 - Compose an email for a new case with required elements and from email address, using Multipart/form-data as content-type. |
customAttributes | Name must match one of the custom attributes configured in application. If the custom attribute is configured as an enumeration, the value must be one of the predefined values. For string type of custom attribute that is not configured as an enumeration, refer list of Allowed Characters For Custom Attributes. |
payload.email.contents | Supported content types are "text" and "html". One or both can be provided. Content can contain macros in the format (two grave accents followed by the macro name): ``<macro_name>. Eg: ``activity_id |
payload.email.emailAddresses.cc | All addresses must be in the valid email address format. Must not exceed 255 characters. Refer email address definition for the valid email address format. |
payload.email.emailAddresses.bcc | All addresses must be in the valid email address format. Must not exceed 255 characters. Refer email address definition for the valid email address format. |
customer | This will be used to create a new customer only if a customer with the email address provided using "payload.email.emailAddresses.to" attribute does not exist in the application. Otherwise, this attribute is ignored. This API does not allow specifying "department.name" attribute in the customer element. Instead, when creating a new customer, customer's department is determined as follows:
Refer the "Customer creation" API for more details about the customer element. |
Each attachment must be present within a separate attachment element. It must have the following representation:
Name | Description |
---|---|
contentType | content type of the attachment content. Must not exceed 255 characters. |
content | content of the attachment in base64 encoded format. Refer Size restrictions section above for allowed content size. |
fileName | Name of the attachment file. Must not exceed 255 characters. |
None
None
Name | Description | Possible values |
---|---|---|
X-egain-session | Session ID of the current user session | N/A |
Content-Type | Media type of response body | application/xml or application/json |
Location | Location of the new created activity | N/A |
201 - Created
400 - Bad Request
401 - Unauthorized
403 - Forbidden
406 - Not Acceptable
500 - Internal server error
Example 1 - Compose email with macros for an existing case with required elements, using XML/JSON as content-type
Example 2 - Compose email with macros for a new case with required elements, using Multipart/form-data as content-type
Example 3 - Compose an email with required elements, from email address and attachments, using XML/JSON as content-type
Example 4 - Compose an email for a new case with required elements and from email address, using Multipart/form-data as content-type
Example 5 - Composing an email for a new customer with all elements, using XML/JSON as content-type
Example 6 - Composing an email for a new customer with all elements, using Multipart/form-data as content-type