Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents:

Table of Contents
minLevel2

Intro

Info
The Transactional API gives you access to all your transactional mailing campaigns in your account.

(info) Note: Notice that in each API call you must provide the List ID that you are working on, otherwise the default List ID will be used. 

Methods Summary

GET /api/transactional

Description 

This method fetches a collection of transactional campaigns.

...

Optional int

limit

Optional int

POST /api/transactional

Description 

This method creates a new transactional campaign.

...

The response will include a newly created transactional campaign array of fields.

PUT /api/transactional/<Transactional Campaign ID>

Description 

This method updates an existing transactional campaign.

...

Code Block
// Request example
{ "name": "My Transactional", "description": "My first transactional campaign" }

POST /api/transactional/send

Description 

This method is used to send a transactional message.

...

Code Block
{
     "message_id": 168,
     "campaign_id": 213,
     "recipients": [ "email@email.com", "..." ],
     "check_status": true,
     "check_suppression": true
}

POST /api/transactional/send_embed_content

Description 

This method is used to send a transactional message with embedded content (without message ID).

...

Code Block
{
  "message": {
    "subject": "Hello!",
       "content_html" :"<html><body><p>This is my content</p></body></html>",
       "addresses": {
            "from_name": "John Doe",
            "from_address": "john@doe.com",
            "reply_address": "john@doe.com"
        }
     },
  "campaign_id": 213,
  "recipients": [ "email@email.com", "..." ],
  "sending_connection_id": 1234
}

POST /api/notify_transactions

Warning

(warning) This method is deprecated, but we're continuing to support it for the long run.
At your convenience please upgrade to: POST /api/transactional/send or POST /api/transactional/send_embed_content method mentioned above.

...

  • 403 - Permission error
  • 404 - Email/Campaign not found

DELETE /API/transactional/<Transactional Campaign ID>

Description

This method deletes a transactional campaign.

Additional Examples

Request Example - Transactional Send - Using specific transactional campaign and specific connection

...

Code Block
{
  "mailing_id": 213,
  "recipients": [ "email@email.com", "..." ],  // You can use Mobile number with Country code (+1XXXXXXXXXX) as well in place of email address.
  "email_message": {
   "content_text": "SMS content",
   "addresses": [
    {
     "from_name": "My name",
     "esp_connection_id": 1
    }
   ]
  },
  "distribution": [
   {
    "esp_connection_id": 1,
    "domain": "default",
    "percent": 100
   }
  ],
  "message_dynamic_fields": { "test": 234, "uid": 32431 },
  "disable_unsubscribe": true
}

Request Example - Using Excluded Segment in Transactional campaign

POST URL: https://api.ongage.net/<list_id>/api/transactional/send
Example below where we used two Exclude segments and sent to three recipients. One of those three recipients was part of one of the excluded segments and it was excluded as can be seen in response.  

Code Block
Request: 
{
     "message_id": 1111111,
     "campaign_id": 1122334455, 
     "excluded_segment_ids": [22222222, 5555555555],
     "recipients": [samplea@domain.com, sample2@domain.com, sample3@domain.com],
     "sending_connection_id":99999
}
  
Response: 
{
"metadata": {
"error": false
},
"payload": {
"total": 3,
"success": 2,
"failed": 1,
"suppressed": 0,
"not_active": 0,
"queued": 0,
"failed_emails": {
"sample1@domain.com": "Excluded",
}
}
}


Appendix

SMTPs that support Cc and Bcc

  • SparkPost