Email API
Updated
You can use Email API to ingest data within Sprinklr as both fan and brand message. To view email details you can create email column in Engagement Dashboards and can also filter based on account Id.
Dev Notes:This API can only be used for ingesting data into Sprinklr.. |
Create Email with Attachment from Url
You can use this API endpoint to create and send an email with attachment, where the attachment is provided as a file url available on web.
API Endpoint
https://api2.sprinklr.com/{{env}}/api/v2/email/create?aId={{Account Id}} |
Headers
API headers include the mandatory information you send along with the request URL and body. This information helps provide insights into request context and authorization credentials that, in turn, allows access to protected resources.
Key | Value | Description |
Authorization | Credential used by the API to authenticate a user with the server For generating authorization token, refer to Authorize section on the developer portal | |
Key | API key helps authenticate the application with the server For generating API key, refer to Getting Started guide | |
Content-Type | Content-Type is a representation header that determines the type of data (media/resource) present in the request body | |
Accept | Determines the acceptable response type from the server |
Query Parameters
Parameter | Required/Optional | Description | Type |
aId | Required | This is the account email Id. The Email Id to which you want to send an email and which is available in Account within Sprinklr. | String |
Dev Notes: Here aID represents the email Id of the Email Account which is available/added in the Account. |
Request Parameters
"brandPost": true,
Parameter | Sub-Parameter | Required/Optional | Description | Type |
from | Required | Email Id of the sender. | String | |
to | Optional | Email Id of the recipient, to whom the brand sent the email. This is
only when you want to ingest the message as brand message. | String | |
brandPost | Optional | By default true. This is
only when you want to ingest the message as brand message. | String | |
subject | Required | Subject of the email. | String | |
body | Required | Email body. | String | |
attachments | Optional | The object containing the attachment details. | Object | |
fileName | Required | The name of the file. | String | |
contentType | Required | The file type. The supported types are
and
| String | |
url | Required | The Url of the attachment that needs to be added from a link. | String |
Example: To ingest data in Sprinklr as Fan message
Request
COPY
curl --location --request POST 'https://api2.sprinklr.com/{env}/api/v2/email/create?aId={brand email Id}' \--header 'Key: {Enter your API key}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {Enter your access token}' \
--header 'Cookie: user.env.type=ENTERPRISE; user.env.type=ENTERPRISE; user.env.type=ENTERPRISE; AWSALB=sR9fAaqtWrHodJvCYr4v7MrDWdEz58pztPdLnBVY0KGyVuGsvaFXstjXwHykFg6gbIW5Z9wGDNgGP3A9uFmh2jkzMAhHN4MQYa1lmvByjwmIGiXkY3gGELFn+vb2; AWSALBCORS=sR9fAaqtWrHodJvCYr4v7MrDWdEz58pztPdLnBVY0KGyVuGsvaFXstjXwHykFg6gbIW5Z9wGDNgGP3A9uFmh2jkzMAhHN4MQYa1lmvByjwmIGiXkY3gGELFn+vb2' \
--data-raw '{
"from": "{Sender email address}",
"to": "{receiver email address}",
"subject": "Reaching out for support",
"body": "<html>\n<body>\n\n<h2>Hi Team </h2>\n\n<ul>\n <li>Please look in to my issue</li>\n <li>Thanks & Regards</li>\n </ul> \n\n</body>\n</html>",
"customProperties": {
"{custom field name}": [
"{Custom field value}"
],
"{custom field name}": [
"{Custom field value}"
]
}
}'
Example - Response
Response
SUCCESS
Example - To ingest data in Sprinklr as Brand message
Request
COPY
curl -X POST \
'https://api2.sprinklr.com/{{env}}/api/v2/email/create?aId={Account Id}' \
-H 'Authorization: Bearer {{Enter your Access Token}}' \
-H 'Key: {{Enter your API KEY}}' \
-H 'Content-Type: application/json' \
-d '{
"from": "abc@xyz.com",
"to": "xyz@test.com",
"subject": "Test Email Query Thread",
"brandPost": true,
"body": "This api is awesome, I like this API.",
"attachments": [
{
"fileName": "excel",
"contentType": "SPREADSHEET",
"url": "https://www.newfile.com/400002/bf8fcd8bf0e8-99344174.xlsx"
}
],"customProperties": {"_c_5fc0cb96b0a31e0d4535f447": ["Value1","Value2"],"_c_5fcb618ed75d24677df0fd22": ["1"],"_c_619696a27d40de0ce801f801":["textField"],"_c_619697007d40de0ce8020268":["1635791400000"],"_c_619696e57d40de0ce801ff54" :[100]}}'
Example - Response
Response
200 OK
SUCCESS
Create Email with Attachments from Local
To create and send an email with or without attachments.
API Endpoint
https://api2.sprinklr.com/{{env}}/api/v2/email/generate?aId={{Account Id}}
Headers
API headers include the mandatory information you send along with the request URL and body. This information helps provide insights into request context and authorization credentials that, in turn, allows access to protected resources.
Key | Value | Description |
Authorization | Credential used by the API to authenticate a user with the server For generating authorization token, refer to Authorize section on the developer portal | |
Key | API key helps authenticate the application with the server For generating API key, refer to Getting Started guide | |
Content-Type | Content-Type is a representation header that determines the type of data (media/resource) present in the request body | |
Accept | Determines the acceptable response type from the server |
Query Parameters
Parameter | Required/Optional | Description | Type |
aId | Required | This is the account email Id. The Email Id to which you want to send an email and which is available in Account within Sprinklr. | String |
Dev Notes: Here aID represents the email Id of the Email Account which is available/added in the Account. |
Request Body Parameters
From-Data | Required/Optional | Description | Type |
from | Required | Email Id of the sender. | String |
subject | Required | Subject of the email. | String |
body | Required | Email body. | String |
file | Optional | Email attachment upto 100mb. | Attachment address |
Supported Attachment Types:
pdf, excel, mp3, mp4, doc, txt, html, image, csv & zip
Note:
Multiple attachments are supported.
Example - Request
Request
COPY
curl --location --request POST 'https://api2.sprinklr.com/{{env}}/api/v2/email/generate?aId={{supportemail@customerdomain.com}}' \--header 'Key: {{Enter your API KEY}}' \--header 'Authorization: Bearer {{Enter your Access Token}}' \--form 'from=anc@xyz.com' \--form 'subject=100 mb image ' \--form 'body=Yeah! test it with attachment' \--form 'file=@/Users/abc/Desktop/Screenshot 2020-07-30 at 5.49.18 PM.png'
Example - Response
Response
200 OK
SUCCESS