Email API for Sending

Effortlessly send emails via Advantus APIs.

To access the Advantus email service, generate the token by authenticating API using client_id and client_secret from the Advantus web application. Then, the token needs to be provided in the header of the email API to send a successful notification.

Pre-Requisites

To get started with Advantus email notifications, please consider the following points.:

  1. Create an application on the Advantus Dashboard. Learn how to create an application on Advantus Dashboard.

  2. Configure your email notification set-up on the Advantus Dashboard. (Learn how to configure email notification set up on Advantus Dashboard)

  3. Generate a token using client_id and client_secret within the Advantus application.

Method Type and API Endpoint

The Method Type and API Endpoint are as follows:

POST: /api/notifications/email

The Header for email sending is:

{
  "Authorization": "YOUR_TOKEN_HERE"
}

API Request

To send a request to the API, the following parameters must be included in the payload.

ItemData typeDescriptionRequired
frequencyobject Frequency refers to the configuration of how often an action or event should occur. It is a parameter that determines the repetition rate or schedule for a particular task or event.No
frequency.typestringThis property indicates the type of frequency. It can be one of three values: Fixed, Immediately, and Intelligent.No
frequency.repeatstringCron is a time-based job scheduling syntax used in Unix-based operating systems to specify recurring tasks. It determines how often the action or event should repeat.

Eg. 0 0 * * *, where the cron value represents a schedule that runs a command or script at midnight (00:00) every day. https://crontab.guru/examples.html
No
receiverobjectConfigure the receiver(s) who will receive this notification.No
receiver.toarrayWhen sending an email, the sender specifies the recipient's email address in the To field, which identifies the intended recipient(s) of the email.No
receiver.to.emailstringEmail address of the intended recipient(s).Yes
receiver.to.{dynamic_fileds}stringPersonalised emails make the messages more relevant and engaging to the recipients.

For example, sending an email to a customer with product recommendations based on their past purchase history, browsing behaviour, or wishlist items, and addressing the customer by name in the email.
No
receiver.ccarrayList of the recipients who will receive a copy of your email.No
receiver.bccarrayList of the recipients who will receive a blind carbon copy of your email.No
subjectstringThe email may have a default subject line at the global or message level, but personalised subject lines can be set for specific recipients or segments of the email recipients, potentially providing a more tailored or customised subject line experience.Yes
subject.contentobjectAn array where you can specify the content of your email.Yes
subject.content.typestringSupported email content types are: 1.text/plain, 2.text/htmlYes
subject.content.valuestringSpecify the actual content that will be displayed to the recipients of the email when they open and view the email message.Yes
attachmentobjectEach attachment object can contain multiple key-value pairs that represent the properties or attributes of the attachment.

You can include a maximum of 5 attachments up to 20 MB.
No
attachment.contentstringThe content is encoded base-64.No
attachment.filenamestringName of the attachment value.No
attachment.typestringThe MIME type of content you are attaching supports the following formats:

- disposition: Inline/attachment
- pdf: application/pdf
- html: text/html
- JPEG image file: "image/jpeg"
- PNG image file: "image/png"
- GIF image file: "image/gif"
- BMP image file: "image/bmp"
- TIFF image file: "image/tiff"
- MP3 audio file: "audio/mpeg"
- WAV audio file: "audio/wav"
- AAC audio file: "audio/aac"
- Ogg Vorbis audio file: "audio/ogg"
- zip : application/zip
- Microsoft Word document file (docx): "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
- Microsoft Excel spreadsheet file (xlsx): "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
- Microsoft PowerPoint presentation file (pptx): "application/vnd.openxmlformats-officedocument.presentationml.presentation"OpenDocument Text document file (odt): "application/vnd.oasis.opendocument.text"
- PDF document file: "application/pdf"
- Plain text document file: "text/plain"
attachment.dispositionstringThe attachment disposition is specify how attached files should be handled in a message, with types including "inline" for displaying in the message and "attachment" for separate download.No

curl --location --request POST 'https://api.getnotifly.io/api/notifications/email' \
--header 'Authorization: YOUR_TOKEN_HERE\
--header 'Content-Type: application/json' \
--data-raw '{
"receiver":
    {
    "to": 
        [
            {
                "email": "RECEIPIENT'S_EMAIL_ADDRESS",
                "name": "RECEIPIENT'S_NAME"
            }
        ],
    "cc": [List_Of_Recipients_Who_will_Receive_Copy_Of_Your_Email
        ],
    "bcc": [List_Of_Recipients_Who_will_Receive_Carbon_Copy_Of_Your_Email
        ]
    },
"subject": "SUBJECT_OF_YOUR_EMAIL",
    "content": 
        {
            "type": "html",
            "value": ""
        },
    "attachments": [
    ]
} 

curl --location --request POST 'https://api.getnotifly.io/api/notifications/email' \
--header 'Authorization: YOUR_TOKEN_HERE\
--header 'Content-Type: application/json' \
--data-raw '{
"receiver":
    {
    "to": 
        [
            {
                "email": "RECEIPIENT'S_EMAIL_ADDRESS",
                "name": "RECEIPIENT'S_NAME"
            }
        ],
    "cc": [List_Of_Recipients_Who_will_Receive_Copy_Of_Your_Email
        ],
    "bcc": [List_Of_Recipients_Who_will_Receive_Carbon_Copy_Of_Your_Email
        ]
    },
"subject": "SUBJECT_OF_YOUR_EMAIL",
    "content": 
        {
            "type": "html",
            "value": ""
        },
    "attachments": [
    ]
}

API Response

When making a request, replace value with your token. If the request is successful, you will get a JSON response containing the access token.

Success response use case

If the API receives a successful request, it will typically return specific parameters as part of the response:

  {
    "success": true,
    "message": "Your notification has been queued for delivery.",
    "data": {
      "notification_id": 4753
    }
  }
ParameterTypeDescriptionMandatory
successbooleanIndicating whether the request was successful or not.Yes
messageboolean/stringInforms of additional value if sent along with the response, which can be either false or a string that defines the action done by the API caller.Yes
dataobjectA JSON object containing information related to the requestYes
data.notification_idintegerA notification id generated after making an API call.Yes

Failure response use case

If the email request fails, the API will return specific parameters (HTTP errors) as part of the response:

Error CodeHTTP StatusCauseSolution
1000401invalid tokenprovide correct token in API request
1003400missing dataprovide the mandatory data in API request
1298400missing/invalid configuration detailsto configure, choose an email service provider and provide the necessary details in the API request