Table of Contents:
Table of Contents minLevel 2
Intro
Info |
---|
The Transactional API gives you access to all your transactional mailing campaigns in your account. |
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.
...
id of list to which this transactional campaign should be attached to.
POST URL: https://api.ongage.net/<list_id>/api/transactional
Code Block |
---|
// Request example { "name": "My Transactional", "description": "My first transactional campaign" } |
...
The response will include a newly created transactional campaign array of fields.
PUT /
...
api/transactional/<Transactional Campaign ID>
Description
This method updates and an existing transactional campaign.
...
id of list to which this transactional campaign should be attached to.
PUT URL: https://api.ongage.net/<list_id>/api/transactional/<transactional_campaign_id>
Code Block |
---|
// Request example { "name": "My Transactional", "description": "My first transactional campaign" } |
POST /
...
api/transactional/send
Description
This method is used to send transactional message.
...
This feature enables marketers to add contacts in list when the respective contact used in request is not part of the sending list.
Example - Basic usage
POST URL: https://api.ongage.net/<list_id/api/transactional/send
Code Block |
---|
{ "message_id": 168, "recipients": [ "email@email.com", "..." ] } |
Example - Using specific transactional campaign and specific connectionconnection
POST URL: https://api.ongage.net/<list_id>/api/transactional_send
Code Block |
---|
{ "message_id":4567, "recipients": [ "email@email.com", "..." ], "campaign_id": 213, "sending_connection_id": 1234 } |
Example - using dynamic fields per recipient
POST URL: https://api.ongage.net/<list_id>/api/transactional_send
Code Block |
---|
// Email with the following HTML <p> Hello {{first_name}} and congratulations on your birthday, you are {{age}} years old! </p> |
...
Example - Using SMS message content
POST URL: https://api.ongage.net/<list_id>/api/transactional_send
Code Block |
---|
{ "message_id":45678, "campaign_id": 213, "recipients": [ "email@email.com", "..." ], "sending_connection_id": 556677, "disable_unsubscribe": true } |
...
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 transactional message with embedded content (without message ID).
...
Recipients for delivery. This must be an array of emails.
Note that for transactional SMS, array of emails is also required.
...
When set to true, this takes into account the contact’s status (unsubscribe, bounced, etc.) and don't send a transactional email if the status is not active.
check_global_and_list_suppression
...
Example - Regular embedded transactional email sending
POST URL: https://api.ongage.net/<list_id>/api/transactional/send_embed_content
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 } |
Example - Regular embedded transactional SMS sending
POST URL: https://api.ongage.net/<list_id>/api/transactional/send_embed_content
Code Block |
---|
{ "message": { "subject": "Hello!", "content_text" :"This is my content", "addresses": { "from_name": "John Doe" } }, "campaign_id": 213, "recipients": [ "email@email.com", "..." ], "sending_connection_id": 1234 } |
Example - Embedded transactional email with "message_dynamic_fields"
POST URL: https://api/ongage.net/<list_id>/api/transactional/send_embed_content
Code Block |
---|
{ "message": { "subject": "Hello!", "content_html" :"<p>You have special discount of {{special_discount}}% until {{expiration_date}}</p>", "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, "message_dynamic_fields": { "special_discount": "50", "expiration_date": "01/01/2020" } } } |
POST /
...
api/notify_transactions
Warning |
---|
This method is being deprecated, but we're continuing to support it for the long run. |
...
Optional array with campaign level suppression list IDs - e.g., "campaign_suppression_list_ids":[ 4060001, 4060002 ]
Example - Using email/sms message ID- Using email/sms message ID
POST URL: https://api.ongage.net/<list_id>/api/notify_transactions
Code Block |
---|
{ "mailing_id": 213, "recipients": [ "email@email.com", "..." ], "email_message_id": 168, // `email_message_id` will override 'email_message' collection if exist "distribution": [ { "esp_connection_id": 2, "domain": "default" } ] } |
Example - Using email message content
POST URL: https://api.ongage.net/<list_id>/api/notify_transactions
Code Block |
---|
{ "mailing_id": 213, "recipients": [ "email@email.com", "..." ], "email_message": { "subject": "Email Subject", "content_html": "<html>Content HTML</html>", "content_text": "Content Text", "addresses": [ { "from_name": "My name", "from_address": "my@address.com", "reply_address": "my@address.com", "esp_connection_id": 1 } ] }, "distribution": [ { "esp_connection_id": 2, "domain": "default", "percent": 100 } ], "message_dynamic_fields": { "test": 234, "uid": 32431 }, "disable_unsubscribe": true } |
Example - Using dynamic fields per recipient
POST URL: https://api.ongage.net/<list_id>/api/notify_transactions
Code Block |
---|
{ "mailing_id": 213, "recipients": [ "john@email.com", "jane@email.com" ], "email_message": { "subject": "Email Subject", "content_html": "<html><p>Hello {{first_name}} and congratulations on your birthday, you are {{age}} years old!</p></html>", "content_text": "Hello {{first_name}} and congratulations on your birthday, you are {{age}} years old!", "addresses": [{ "from_name": "My name", "from_address": "my@address.com", "reply_address": "my@address.com", "esp_connection_id": 1 }] }, "distribution": [ { "esp_connection_id": 2, "domain": "default", "percent": 100 } ], "message_dynamic_fields_per_recipient":[ { "recipient":"john@email.com", "key_value_collection": { "first_name":"John", "age": 34 } }, { "recipient":"jane@email.com", "key_value_collection": { "first_name": "Jane", "age": 28 } } ] } |
Example - Using SMS message content
POST URL: https://api.ongage.net/<list_id>/api/notify_transactions
Code Block |
---|
{ "mailing_id": 213, "recipients": [ "email@email.com", "..." ], "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 } |
...
- 403 - Permission error
- 404 - Email/Campaign not found
DELETE /API/transactional/<Transactional Campaign ID>
Description
This method deletes a transactional campaign.
Appendix
SMTPs that support Cc and Bcc
MailGun
Amazon SES
MailJet
mySMTP
Oracle Dyn (On Request)
SocketLabs
SparkPost
Sendgrid