Create preference and send notification

Creates the notification preference if it does not exist and sends the notification. Call this method only for one system user. UserService uses this method to send system emails

Request
Security:
vc-security
Request Body schema: application/json
id
string
sender
string

Pass the sender email if you don't want to use default sender email address

Array of objects (UserKey)

An array of UserKeys who will receive the emails. This is required to send email to system users

rawRecipient
string

Email address of the receiver. This is required to send email to non system user

type
string (Type)

The type of the notification

Enum: "EMAIL" "SMS" "PHONE" "WEB"
eventKey
string

Key of the notification event. It is mandatory for system users. Event key must already exists.

productName
string

Name of the product for which notification has been sent for. Notification History uses this

tags
Array of strings

Any tag that should be saved with the notification entity

language
string

Locale of template. for example en. It is mandatory if you provide the template name for non system user

summary
string

Subject of the notification if it is email or content of the notification if it is sms.Summary is mandatory if you don’t provide template name

details
string

Content of the notification if it is an email. Details is mandatory if you don’t provide the template name or it is a digest email

shortSubject
string

Short subject of the notification that will be displayed in the notification history of a system user. Provide it if you want to override the short subject from the template.

shortDescription
string

Short summary of the notification that will be displayed in the notification history of a system user. Provide it if you want to override the short summary from the template.

templateNameKey
string

The template name key if you want to send the email using template. This is required for a templated email. The template must exist in the system.

object

Key/value pair for the variables that you wanna replace with the value in the template. The template variables are defined using {{variablename}}. For example you have a variable called username in template and defined as {{username}}, you can pass "dataModel":{"username":"TestUser"} to replate username with value TestUser

status
string (Status)

The status of the notification

Enum: "CREATED" "QUEUED" "SENT" "DELIVERED" "READ" "ERRORED" "DIGESTED" "PROCESSED" "DROPPED" "DEFERRED" "BOUNCED" "ACCEPTED" "SCHEDULED" "SENDING" "UNDELIVERED" "FAILED" "CANCELED"
messageId
string

The message ID from the provider

responseCode
integer

The response code from the provider

responseMsg
string

The response message from the provider

userOrgId
string

OrgID of the user. It is required when user preference needs to be created before sending the notification

emailForPreference
string

Email of the user that will be saved under preference. It is required when user preference needs to be created before sending the notification

attachmentContent
string <byte>

Content (byte[]) of the email attachment. The file upto 10MB is supported. This is required for email with attachment.

attachmentMimeType
string

MIME type of the email attachment. This is required for email with attachment. Ex. text/plain or text/html

attachmentFilename
string

File name of the email attachment. This is required for email with attachment. Ex. TestDocument.txt

createdBy
string
createdInstant
string <date-time>
lastUpdatedBy
string
lastUpdatedInstant
string <date-time>
Responses
200

ok

401

Unauthorized request

404

Bad Request. The request parameters (or body) were malformed or invalid. Fix the issues with the request and try again.

post/notification-service/v1/notify-with-preference
Request samples
application/json
{
  • "id": "string",
  • "sender": "string",
  • "recipients": [
    ],
  • "rawRecipient": "string",
  • "type": "EMAIL",
  • "eventKey": "string",
  • "productName": "string",
  • "tags": [
    ],
  • "language": "string",
  • "summary": "string",
  • "details": "string",
  • "shortSubject": "string",
  • "shortDescription": "string",
  • "templateNameKey": "string",
  • "dataModel": {
    },
  • "status": "CREATED",
  • "messageId": "string",
  • "responseCode": 0,
  • "responseMsg": "string",
  • "userOrgId": "string",
  • "emailForPreference": "string",
  • "attachmentContent": "string",
  • "attachmentMimeType": "string",
  • "attachmentFilename": "string",
  • "createdBy": "string",
  • "createdInstant": "2019-08-24T14:15:22Z",
  • "lastUpdatedBy": "string",
  • "lastUpdatedInstant": "2019-08-24T14:15:22Z"
}
Response samples
application/json
{
  • "message": "Could not verify Webhook request",
  • "status": 401,
  • "error": "Unauthorized",
  • "timestamp": "2023-12-13T19:02:31.5897497",
  • "path": "/notification-service/v1/"
}