![]() |
Using a single DLL library, C# / .NET developers can send Email, SMS, Fax, Voice and Text-to-Speech messages using their own software.
SendMode parameter in your message object to skip message delivery. The message will be accepted and processed with a simulated delivery result displayed. Head to https://www.tnz.co.nz/Customer/SignUp to create a new account.
A test account is possible, however creating a commerical account and using the SendMode=[MessageType].SendModeType.Test function of the library is simpler to use when you’re ready to push your application live.
After completing the sign up form, a sales consultant will manually activate your account. This may take one business day. Once the account has been activated, you will be able to Create a new API user token.
Using the API will require a Sender and APIKey pair to authenticate with the API.
You can generate this using the Web Dashboard under: Users | Outbound Users | Create
User Email Address = Sender
User Token = APIKey
Save hundreds of lines of code and hours of time by dropping the .NET DLL into your project and sending messages via TNZ. Using one DLL and simple code tweaks, your software can send Email, SMS, Fax, Voice and Text-to-Speech messages.
Using the [MessageType].SendMessage() function, the DLL will connect to TNZ's REST API (in XML format) and submit messages.
Step 1: Download and extract the .NET library DLL: TNZAPI.dll.zip
Step 2:Add Reference downloaded DLL into your project(s)
Step 3: Reference library to your code
using TNZAPI;
using TNZAPI.Messaging;
using TNZAPI.Messaging.Functions;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Send;
using TNZAPI.Messaging.Get;
Step 4: Download and Sample Code (Optional): C# Sample Codes
Contains:
using TNZAPI.Messaging.Send;
namespace TNZEmailBasic
{
class Program
{
static void Main(string[] args)
{
Email EmailMessage = new Email();
EmailMessage.Sender = "YOUR_EMAIL_ADDRESS"; // API Username
EmailMessage.APIKey = "YOUR_API_KEY"; // API Key
EmailMessage.FromEmail = "[email protected]"; // Optional : Sets From Email Address - leave blank to use your api username as email sender
EmailMessage.EmailSubject = "Test Email"; // Email Subject
EmailMessage.MessagePlain = "Test Email Body"; // Email Body
EmailMessage.Recipient = "[email protected]"; // Recipient
EmailMessage.SendMessage();
}
}
}
using System;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Send;
namespace TNZEmailSimple
{
class Program
{
static void Main(string[] args)
{
const string sender = "YOUR_EMAIL_ADDRESS"; // API Username
const string api_key = "YOUR_API_KEY"; // API Key
const string from_email = "[email protected]"; // Optional : Sets From Email Address - leave blank to use your api username as email sender
const string subject = "Test Email"; // Email Subject
const string message_plain = "Test Email Body"; // Email Body (Plain Text)
const string recipient = "[email protected]"; // Recipient
Email EmailMessage = new Email(sender, api_key);
EmailMessage.SetEmailFrom(from_email);
EmailMessage.AddRecipient(recipient);
MessageResult response = EmailMessage.SendMessage(
subject,
message_plain
);
if (response.Result == MessageResult.ResultCode.Success)
{
Console.WriteLine("Success - " + response.MessageID);
}
else
{
Console.WriteLine("Error - " + response.ErrorMessage);
}
}
}
}
using System;
using System.Collections.Generic;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Send;
using TNZAPI.Messaging.Functions;
namespace TNZEmailAdvanced
{
class Program
{
static void Main(string[] args)
{
#region Declarations
const string sender = "YOUR_EMAIL_ADDRESS";
const string api_key = "YOUR_API_KEY";
const string reference = "Test Email - Advanced version";
const string recipient1 = "[email protected]";
const string recipient2 = "[email protected]";
const string recipient3 = "[email protected]";
const string recipient4 = "[email protected]";
const string file1 = "c:\\file1.pdf";
const string file2 = "c:\\file2.pdf";
const string file3 = "c:\\file3.pdf";
const string file4 = "c:\\file4.pdf";
const string smtp_from = "[email protected]";
const string from_name = "Test Email";
const string from_email = "[email protected]";
const string reply_to = "[email protected]";
const string subject = "TNZ API Email - Advanced";
const string message_plain = "Test Email Body";
const string message_html = "<html><body><p>This is <b>Test message body</b>. Thank you so much!</p></body></html>";
#endregion Declarations
Email EmailMessage = new Email(sender, api_key);
#region Add Recipients
//
// Add Recipient Method 1 - AddRecipient(string recipient);
//
EmailMessage.AddRecipient(recipient1);
//
// Add Recipient Method 2 - AddRecipient(new Recipient())
//
Recipient recipient = new Recipient();
recipient.EmailAddress = recipient2; // Recipient
recipient.CompanyName = "Test Company"; // Company Name
recipient.Attention = "Test Recipient 2"; // Attention
recipient.Custom1 = "Custom1"; // Custom1
recipient.Custom2 = "Custom2"; // Custom2
recipient.Custom3 = "Custom3"; // Custom3
recipient.Custom4 = "Custom4"; // Custom4
recipient.Custom5 = "Custom5"; // Custom5
EmailMessage.AddRecipient(recipient);
//
// Add Recipient Method 3 - AddRecipients(new List<Recipient>()); using simple destination
//
List<Recipient> recipients = new List<Recipient>();
recipients.Add(new Recipient(recipient3));
//
// Add Recipient Method 4 - AddRecipients(new List<Recipient>()) using Recipient objects
//
recipients.Add(new Recipient(
recipient4, // Recipient
"Test Company", // Company Name
"Test Recipient 3", // Attention
"Custom1", // Custom1
"Custom2", // Custom2
"Custom3", // Custom3
"Custom4", // Custom4
"Custom5" // Custom5
));
EmailMessage.AddRecipients(recipients);
#endregion Add Recipients
#region Add Attachments
//
// Add Attachment Method 1 - AddAttachment(file_location);
//
EmailMessage.AddAttachment(file1);
//
// Add Attachment Method 2 - AddAttachment(new Attachment());
//
Attachment attachment = new Attachment();
attachment.FileName = FileHandlers.GetFileName(file2);
attachment.FileContent = FileHandlers.GetFileContents(file2);
EmailMessage.AddAttachment(attachment);
//
// Add Attachment Method 3 - AddAttachments(new List<Attachment>()) using simple file locations
//
List<Attachment> attachments = new List<Attachment>();
attachments.Add(new Attachment(file3));
//
// Add Attachment Method 4 - AddAttachments(new List<Attachment>()) using Attachment objects
//
attachments.Add(new Attachment(
FileHandlers.GetFileName(file4),
FileHandlers.GetFileContents(file4)
));
EmailMessage.AddAttachments(attachments);
#endregion Add Attachments
#region Set SMTP Headers
// Set email sender
EmailMessage.SetEmailFrom(
smtp_from,
from_name,
from_email,
reply_to
);
#endregion Set SMTP Headers
MessageResult response = EmailMessage.SendMessage(
subject, //Subject
message_plain, //MessagePlain
message_html, //MessageHTML
"", //MessageID
reference, //Reference
new DateTime(), //SendTime
"New Zealand", //Timezone
"", //SubAccount
"", //Department
"" //ChargeCode
);
if (response.Result == MessageResult.ResultCode.Success)
{
Console.WriteLine("Success - "+response.MessageID);
}
else
{
Console.WriteLine("Error - " + response.ErrorMessage);
}
}
}
}
| Parameter | Example Value | Description | |
|---|---|---|---|
| Sender | [email protected] | Sender value set up in Create a new API user token | |
| APIKey | ta8wr7ymd | APIKey value set up in Create a new API user token | |
| EmailSubject | Test Email | Sets the email subject | |
| MessagePlain | Hello, This is a test message. Thank you. |
Content used for the message/plain section of the email (overrides 'Template') | |
| Recipient | [email protected] | Sets single recipient. For more options, refer to Optional Parameter recipients section | |
| Parameter | Example Value | Description | |
|---|---|---|---|
| MessageID | ID12345 | Tracking ID or message description. Leave black if you want us to generate one. | |
| Reference | Test1 | Reference of your message | |
| SendTime | new DateTime() | Delay sending until the specified date/time (dd/mm/yyyy HH:mm in your local timezone, specified by your Sender setting or overridden using the TimeZone command) | |
| Timezone | New Zealand | Timezone specified using Windows timezone value (default set using Web Dashboard can be overridden here) See Microsoft Timezones (use the Country value) |
|
| SubAccount | SubAccount01 | Used for reporting, billing and Web Dashboard segmentation | |
| Department | Department01 | Used for reporting, billing and Web Dashboard segmentation | |
| ChargeCode | BillingGroup01 | Cost allocation for billing | |
| SMTPFrom | [email protected] | Sets the email Sender/Return-Path at the SMTP level (this address receives bounce-back emails and is used for SPF/DKIM type authentication; 'FromEmail' is used if not specified) | |
| From | noreply | Sets the email sender's Friendly Name (seen by the email recipient) | |
| FromEmail | [email protected] | Sets the email sender's Email Address (seen by the email recipient; API 'Sender' is used if not specified) | |
| ReplyTo | [email protected] | Sets the email sender's Reply-To Address (if the recipient replies, the Reply To will receive the reply) | |
| MessageHTML | <html>Hello,<br /><br />This is a test message.<br /><br />Thank you.</html> | Content used for the message/html section of the email (overrides 'Template' and 'MessagePlain') | |
| Recipients | > Recipient | [email protected] | Recipient of the email |
| > Attention | Recipient One | Recipient's friendly name | |
| > Company | Example Corp | Recipient's company | |
| > Custom1 | Recipient One | Customisable field | |
| > Custom2 | Recipient One | Customisable field | |
| Attachments | > Name | Sample.pdf | Attachment's filename |
| > Data | %%Base-64%% | Base-64 encoded value of the attached file | |
| Function | Usage | Description | |
|---|---|---|---|
| AddRecipient() |
AddRecipient(string recipient) AddRecipient(Recipient recipient) |
Function to add a single message recipient | |
| AddRecipients() |
AddRecipients(List<string> recipients) AddRecipients(List<Recipient> recipients) |
Function to add a list of message recipients | |
| AddAttachment() |
AddAttachment(string file_location) AddAttachment(Attachment attachment) |
Function to add a single attachment to the message (the .NET library will grab the file contents from the specified file location) | |
| AddAttachments() |
AddAttachments(List<string> file_locations) AddAttachments(List<Attachment> attachments) |
Function to add multiple attachment to the message (the .NET library will grab the file contents from the specified file location) | |
| SetEmailFrom() |
SetEmailFrom(string from_email) SetEmailFrom(string from_name, string from_email) SetEmailFrom(string from_name, string from_email, string reply_to) SetEmailFrom(string smtp_from, string from_name, string from_email, string reply_to) |
Function to set the SMTP From headers (domains require SPF and other security features enabled - contact your Sales Representative for details) | |
| SendMessage() |
SendMessage() SendMessage(string message_text) SendMessageSendMessage(string message_id, string reference, DateTime send_time, string timezone, string subaccount, string department, string charge_code, string sms_email_reply, string force_gsm_chars, string message_text) |
Function to submit messages to TNZ REST API Returns MessageResult object |
|
using TNZAPI.Messaging.Send;
namespace TNZSMSBasic
{
class Program
{
static void Main(string[] args)
{
SMS SMSMessage = new SMS();
SMSMessage.Sender = "YOUR_EMAIL_ADDRESS";
SMSMessage.APIKey = "YOUR_API_KEY";
SMSMessage.MessageText = "Test SMS";
SMSMessage.Recipient = "+64211231234";
SMSMessage.SendMessage();
}
}
}
using System;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Send;
namespace TNZSMSSimple
{
class Program
{
static void Main(string[] args)
{
const string sender = "YOUR_EMAIL_ADDRESS";
const string api_key = "YOUR_API_KEY";
const string recipient = "64211231234";
const string message_text = "Test SMS";
SMS SMSMessage = new SMS(sender, api_key);
SMSMessage.AddRecipient(recipient);
MessageResult response = SMSMessage.SendMessage(message_text);
if (response.Result == MessageResult.ResultCode.Success)
{
Console.WriteLine("Success - " + response.MessageID);
}
else
{
Console.WriteLine("Error - " + response.ErrorMessage);
}
}
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Send;
using TNZAPI.Messaging.Functions;
namespace TNZSMSAdvanced
{
class Program
{
static void Main(string[] args)
{
#region Declarations
const string sender = "YOUR_EMAIL_ADDRESS";
const string api_key = "YOUR_API_KEY";
const string reference = "Test SMS - Advanced version";
const string sms_email_reply = "REPLY_EMAIL_ADDRESS";
const string force_gsm_chars = "True";
const string recipient1 = "64211231234";
const string recipient2 = "64221231234";
const string recipient3 = "64231231234";
const string recipient4 = "64241231234";
const string file1 = "C:\\file1.pdf";
const string file2 = "C:\\file2.pdf";
const string file3 = "C:\\file3.pdf";
const string file4 = "C:\\file4.pdf";
const string message_text = "Test SMS Message [[File1]] | [[File2]] | [[File3]] | [[File4]]";
#endregion Declarations
SMS SMSMessage = new SMS(sender, api_key);
#region Add Recipients
//
// Add Recipient Method 1 - AddRecipient(string recipient);
//
SMSMessage.AddRecipient(recipient1);
//
// Add Recipient Method 2 - AddRecipient(new Recipient())
//
Recipient recipient = new Recipient(recipient2);
recipient.CompanyName = "Test Company"; // Company Name
recipient.Attention = "Test Recipient 2"; // Attention
recipient.Custom1 = "Custom1"; // Custom1
recipient.Custom2 = "Custom2"; // Custom2
recipient.Custom3 = "Custom3"; // Custom3
recipient.Custom4 = "Custom4"; // Custom4
recipient.Custom5 = "Custom5"; // Custom5
SMSMessage.AddRecipient(recipient);
//
// Add Recipient Method 3 - AddRecipients(new List<Recipient>()); using simple destination
//
List<Recipient> recipients = new List<Recipient>();
recipients.Add(new Recipient(recipient3));
//
// Add Recipient Method 4 - AddRecipients(new List<Recipient>()) using Recipient objects
//
recipients.Add(new Recipient(
recipient4, // Recipient
"Test Company", // Company Name
"Test Recipient 4", // Attention
"Custom1", // Custom1
"Custom2", // Custom2
"Custom3", // Custom3
"Custom4", // Custom4
"Custom5" // Custom5
));
SMSMessage.AddRecipients(recipients);
#endregion Add Recipients
#region Add Attachments
/*
* Please note:
*
* Attachments are only supported with MessageLink - Please ask us to enable MessageLink
*
* Attachments will get ignored if you have not MessageLink functionality
*/
//
// Add Attachment Method 1 - AddAttachment(file_location);
//
SMSMessage.AddAttachment(file1);
//
// Add Attachment Method 2 - AddAttachment(new Attachment());
//
Attachment attachment = new Attachment();
attachment.FileName = FileHandlers.GetFileName(file2);
attachment.FileContent = FileHandlers.GetFileContents(file2);
SMSMessage.AddAttachment(attachment);
//
// Add Attachment Method 3 - AddAttachments(new List<Attachment>()) using simple file locations
//
List<Attachment> attachments = new List<Attachment>();
attachments.Add(new Attachment(file3));
//
// Add Attachment Method 4 - AddAttachments(new List<Attachment>()) using Attachment objects
//
attachments.Add(new Attachment(
FileHandlers.GetFileName(file4),
FileHandlers.GetFileContents(file4)
));
SMSMessage.AddAttachments(attachments);
#endregion Add Attachments
MessageResult response = SMSMessage.SendMessage(
"", // MessageID - Leave blank to auto-generate
reference, // Reference
new DateTime(), // SendTime
"New Zealand", // Timezone
"", // SubAccount
"", // Department
"", // ChargeCode
sms_email_reply, // SMSEmailReply - For email (SMTP) reply receipt notifications
force_gsm_chars, // ForceGSMChars
message_text
);
if (response.Result == MessageResult.ResultCode.Success)
{
Console.WriteLine("Success - " + response.MessageID);
}
else
{
Console.WriteLine("Error - " + response.ErrorMessage);
}
}
}
}
| Parameter | Example Value | Description | |
|---|---|---|---|
| Sender | [email protected] | Sender value set up in Create a new API user token | |
| APIKey | ta8wr7ymd | APIKey value set up in Create a new API user token | |
| MessageText | Hello, this is a test message from Department01. Thank you. | Plain or UTF-8 formatted SMS message | |
| Recipient | +6421000002 | Sets single recipient. For more options, refer to Optional Parameter recipients section | |
| Parameter | Example Value | Description | |
|---|---|---|---|
| MessageID | ID12345 | Tracking ID or message description. Leave black if you want us to generate one. | |
| Reference | Test1 | Tracking ID or message description | |
| SendTime | new DateTime() | Delay sending until the specified date/time (dd/mm/yyyy HH:mm in your local timezone, specified by your Sender setting or overridden using the TimeZone command) | |
| TimeZone | New Zealand | Timezone specified using Windows timezone value (default set using Web Dashboard can be overridden here) See Microsoft Timezones (use the Country value) |
|
| SubAccount | SubAccount01 | Used for reporting, billing and Web Dashboard segmentation | |
| Department | Department01 | Used for reporting, billing and Web Dashboard segmentation | |
| ChargeCode | BillingGroup01 | Cost allocation for billing | |
| FromNumber | +6421000001 | Setting SMS origination number, short code(s) will override in New Zealand - Not for New Zealand. | |
| SMSEmailReply | [email protected] | For email (SMTP) reply receipt notifications | |
| ForceGSMChars | true | Convert multi-byte characters into normalised GSM character format. ie. © to (C) | |
| Recipients | > MobileNumber | +6421000001 | Recipient of the SMS in E.164 internationalised format |
| > Attention | Recipient One | Recipient's friendly name | |
| > Company | Example Corp | Recipient's company | |
| > Custom1 | Recipient One | Customisable field | |
| > Custom2 | Recipient One | Customisable field | |
| Function | Usage | Description | |
|---|---|---|---|
| AddRecipient() |
AddRecipient(string recipient) AddRecipient(Recipient recipient) |
Function to add a single message recipient | |
| AddRecipients() |
AddRecipients(List<string> recipients) AddRecipients(List<Recipient> recipients) |
Function to add a list of message recipients | |
| AddAttachment() |
AddAttachment(string file_location) AddAttachment(Attachment attachment) |
Function to add a single attachment to the message (the .NET library will grab the file contents from the specified file location) | |
| AddAttachments() |
AddAttachments(List<string> file_locations) AddAttachments(List<Attachment> attachments) |
Function to add multiple attachments to the message (the .NET library will grab the file contents from the specified file location) | |
| SendMessage() |
SendMessage() SendMessage(string email_subject, string message_plain) SendMessage(string email_subject, string message_plain, string message_html) SendMessage(string email_subject, string message_plain, string message_html, string message_id, string reference, DateTime send_time, string timezone, string subaccount, string department, string charge_code) SendMessage(string email_subject, string message_plain, string message_html, string message_id, string reference, DateTime send_time, string timezone, string subaccount, string department, string charge_code, string smtp_from, string from_name, string from_email, string reply_to ) |
Function to submit messages to TNZ REST API Returns MessageResult object |
|
using TNZAPI.Messaging.Send;
namespace TNZFaxBasic
{
class Program
{
static void Main(string[] args)
{
Fax FaxMessage = new Fax();
FaxMessage.Sender = "YOUR_EMAIL_ADDRESS";
FaxMessage.APIKey = "YOUR_API_KEY";
FaxMessage.Recipient = "+6491231234";
FaxMessage.AddAttachment("C:\\File1.pdf");
FaxMessage.SendMessage();
}
}
}
using System;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Send;
namespace TNZFaxSimple
{
class Program
{
static void Main(string[] args)
{
const string sender = "YOUR_EMAIL_ADDRESS";
const string api_key = "YOUR_API_KEY";
const string recipient = "+6491231234";
const string file = "C:\\File1.pdf";
Fax FaxMessage = new Fax(sender, api_key);
FaxMessage.AddRecipient(recipient);
FaxMessage.AddAttachment(file);
MessageResult response = FaxMessage.SendMessage();
if (response.Result == MessageResult.ResultCode.Success)
{
Console.WriteLine("Success - " + response.MessageID);
}
else
{
Console.WriteLine("Error - " + response.ErrorMessage);
}
}
}
}
using System;
using System.Collections.Generic;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Send;
using TNZAPI.Messaging.Functions;
namespace TNZFaxAdvanced
{
class Program
{
static void Main(string[] args)
{
#region Declarations
const string sender = "YOUR_EMAIL_ADDRESS";
const string api_key = "YOUR_API_KEY";
const string reference = "Test Fax - Advanced version";
const string recipient1 = "+6491231234";
const string recipient2 = "+6471231234";
const string recipient3 = "+6461231234";
const string recipient4 = "+6441231234";
const string file1 = "C:\\file1.pdf";
const string file2 = "C:\\file2.pdf";
const string file3 = "C:\\file3.pdf";
const string file4 = "C:\\file4.pdf";
const string resolution = "High";
const string csid = "TEST FAX";
const int retry_attempts = 3;
const int retry_period = 1;
#endregion Declarations
Fax FaxMessage = new Fax(sender, api_key);
#region Add Recipients
//
// Add Recipient Method 1 - AddRecipient(string recipient);
//
FaxMessage.AddRecipient(recipient1);
//
// Add Recipient Method 2 - AddRecipient(new Recipient())
//
Recipient recipient = new Recipient(recipient2);
recipient.CompanyName = "Test Company"; // Company Name
recipient.Attention = "Test Recipient 2"; // Attention
recipient.Custom1 = "Custom1"; // Custom1
recipient.Custom2 = "Custom2"; // Custom2
recipient.Custom3 = "Custom3"; // Custom3
recipient.Custom4 = "Custom4"; // Custom4
recipient.Custom5 = "Custom5"; // Custom5
FaxMessage.AddRecipient(recipient);
//
// Add Recipient Method 3 - AddRecipients(new List<Recipient>()); using simple destination
//
List<Recipient> recipients = new List<Recipient>();
recipients.Add(new Recipient(recipient3));
//
// Add Recipient Method 4 - AddRecipients(new List<Recipient>()) using Recipient objects
//
recipients.Add(new Recipient(
recipient4, // Recipient
"Test Company", // Company Name
"Test Recipient 4", // Attention
"Custom1", // Custom1
"Custom2", // Custom2
"Custom3", // Custom3
"Custom4", // Custom4
"Custom5" // Custom5
));
FaxMessage.AddRecipients(recipients);
#endregion Add Recipients
#region Add Attachments
//
// Add Attachment Method 1 - AddAttachment(file_location);
//
FaxMessage.AddAttachment(file1);
//
// Add Attachment Method 2 - AddAttachment(new Attachment());
//
Attachment attachment = new Attachment();
attachment.FileName = FileHandlers.GetFileName(file2);
attachment.FileContent = FileHandlers.GetFileContents(file2);
FaxMessage.AddAttachment(attachment);
//
// Add Attachment Method 3 - AddAttachments(new List<Attachment>()) using simple file locations
//
List<Attachment> attachments = new List<Attachment>();
attachments.Add(new Attachment(file3));
//
// Add Attachment Method 4 - AddAttachments(new List<Attachment>()) using Attachment objects
//
attachments.Add(new Attachment(
FileHandlers.GetFileName(file4),
FileHandlers.GetFileContents(file4)
));
FaxMessage.AddAttachments(attachments);
#endregion Add Attachments
MessageResult response = FaxMessage.SendMessage(
"", // MessageID - Leave blank to auto-generate
reference, // Reference
new DateTime(), // SendTime
"New Zealand", // Timezone
"", // SubAccount
"", // Department
"", // ChargeCode
resolution, // Resolution - High/Low
csid, // CSID
"", // WaterMarkFolder
"", // WaterMarkFirstPage
"", // WaterMarkAllPages
retry_attempts, // RetryAttempts - no of retries
retry_period // RetryPeriod - no of minutes between retries
);
if (response.Result == MessageResult.ResultCode.Success)
{
Console.WriteLine("Success - " + response.MessageID);
}
else
{
Console.WriteLine("Error - " + response.ErrorMessage);
}
}
}
}
| Parameter | Example Value | Description | |
|---|---|---|---|
| Sender | [email protected] | Sender value set up in Create a new API user token | |
| APIKey | ta8wr7ymd | APIKey value set up in Create a new API user token | |
| Recipient | +6495005001 | Sets single recipient. For more options, refer to Optional Parameter Recipients section | |
| Attachment | > Name | Sample.pdf | Fax document's filename |
| > Data | %%Base-64%% | Base-64 encoded value of the document | |
| Parameter | Example Value | Description | |
|---|---|---|---|
| MessageID | ID12345 | Tracking ID or message description. Leave black if you want us to generate one. | |
| Reference | Test1 | Reference of your message | |
| SendTime | new DateTime() | Delay sending until the specified date/time (dd/mm/yyyy HH:mm in your local timezone, specified by your Sender setting or overridden using the TimeZone command) | |
| Timezone | New Zealand | Timezone specified using Windows timezone value (default set using Web Dashboard can be overridden here) See Microsoft Timezones (use the Country value) |
|
| SubAccount | SubAccount01 | Used for reporting, billing and Web Dashboard segmentation | |
| Department | Department01 | Used for reporting, billing and Web Dashboard segmentation | |
| ChargeCode | BillingGroup01 | Cost allocation for billing | |
| WatermarkFolder | Folder01 | Directory/location of Watermark file to use | |
| WatermarkFirstPage | Watermark File Name | Watermark file to apply to the first page only | |
| WatermarkAllPages | Watermark File Name | Watermark file to apply to all pages | |
| Resolution | High | Quality of the fax image. High for better quality, low for lower quality (faster delivery speed) | |
| CSID | Station ID | Called Subscriber Identification - Maximum 30 characters | |
| RetryAttempts | 3 | Number of retries (retry_period required) | |
| RetryPeriod | 1 | Minutes between retries (retry_attempts required) | |
| Recipients | > Recipient | +6495005000 | Recipient of the Fax in E.164 internationalised format |
| > Attention | Recipient One | Recipient's friendly name | |
| > Company | Example Corp | Recipient's company | |
| > Custom1 | Recipient One | Customisable field | |
| > Custom2 | Recipient One | Customisable field | |
| Function | Usage | Description | |
|---|---|---|---|
| AddRecipient() |
AddRecipient(string recipient) AddRecipient(Recipient recipient) |
Function to add a single message recipient | |
| AddRecipients() |
AddRecipients(List<string> recipients) AddRecipients(List<Recipient> recipients) |
Function to add a list of message recipients | |
| AddAttachment() |
AddAttachment(string file_location) AddAttachment(Attachment attachment) |
Function to add a single attachment to the message (the .NET library will grab the file contents from the specified file location) | |
| AddAttachments() |
AddAttachments(List<string> file_locations) AddAttachments(List<Attachment> attachments) |
Function to add multiple attachments to the message (the .NET library will grab the file contents from the specified file location) | |
| SendMessage() |
SendMessage() SendMessage(string email_subject, string message_plain) SendMessage(string email_subject, string message_plain, string message_html) SendMessage(string email_subject, string message_plain, string message_html, string message_id, string reference, DateTime send_time, string timezone, string subaccount, string department, string charge_code) SendMessage(string email_subject, string message_plain, string message_html, string message_id, string reference, DateTime send_time, string timezone, string subaccount, string department, string charge_code, string smtp_from, string from_name, string from_email, string reply_to ) |
Function to submit messages to TNZ REST API Returns MessageResult object |
|
using TNZAPI.Messaging.Functions;
using TNZAPI.Messaging.Send;
namespace TNZVoiceBasic
{
class Program
{
static void Main(string[] args)
{
Voice VoiceMessage = new Voice();
VoiceMessage.Sender = "YOUR_EMAIL_ADDRESS";
VoiceMessage.APIKey = "YOUR_API_KEY";
VoiceMessage.MessageToPeople = FileHandlers.GetFileContents("C:\\Message.wav");
VoiceMessage.Recipient = "+6491231234";
VoiceMessage.SendMessage();
}
}
}
using System;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Send;
namespace TNZVoiceSimple
{
class Program
{
static void Main(string[] args)
{
const string sender = "YOUR_EMAIL_ADDRESS";
const string api_key = "YOUR_API_KEY";
const string recipient = "+6491231234";
const string file = "C:\\Message.wav";
Voice VoiceMessage = new Voice(sender, api_key);
VoiceMessage.AddMessageData(Voice.MessageDataType.MessageToPeople, file);
VoiceMessage.AddRecipient(recipient);
MessageResult response = VoiceMessage.SendMessage();
if (response.Result == MessageResult.ResultCode.Success)
{
Console.WriteLine("Success - " + response.MessageID);
}
else
{
Console.WriteLine("Error - " + response.ErrorMessage);
}
}
}
}
using System;
using System.Collections.Generic;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Send;
namespace TNZVoiceAdvanced
{
class Program
{
static void Main(string[] args)
{
const string sender = "YOUR_EMAIL_ADDRESS";
const string api_key = "YOUR_API_KEY";
const string reference = "Test Voice - Advanced version";
const string caller_id = "+6499293000";
const string billing_account = "TEST BILLING ACCOUNT";
const string recipient1 = "+64211111111";
const string recipient2 = "+64212222222";
const string recipient3 = "+64213333333";
const string recipient4 = "+64214444444";
const string message_to_people = "C:\\Message1.wav";
const string message_to_answerphones = "C:\\Message2.wav";
const string call_route_message_to_people = "C:\\Message3.wav";
const string call_route_message_to_operators = "C:\\Message4.wav";
const string call_route_message_on_wrong_key = "C:\\Message5.wav";
const int number_of_operators = 1;
const string keypad1_route = "+6491111111";
const string keypad2_route = "+6492222222";
const string keypad3_route = "+6493333333";
const string keypad4_route = "+6494444444";
Voice VoiceMessage = new Voice(sender, api_key);
#region Call Options
VoiceMessage.Reference = reference;
VoiceMessage.CallerID = caller_id;
VoiceMessage.SubAccount = billing_account;
VoiceMessage.NumberOfOperators = number_of_operators;
#endregion Call Options
#region Submit Audio Files
//
// Submit audio files - WAV format, 16-bit, 8000hz
//
VoiceMessage.AddMessageData(Voice.MessageDataType.MessageToPeople, message_to_people);
VoiceMessage.AddMessageData(Voice.MessageDataType.MessageToAnswerPhones, message_to_answerphones);
VoiceMessage.AddMessageData(Voice.MessageDataType.CallRouteMessageToPeople, call_route_message_to_people);
VoiceMessage.AddMessageData(Voice.MessageDataType.CallRouteMessageToOperators, call_route_message_to_operators);
VoiceMessage.AddMessageData(Voice.MessageDataType.CallRouteMessageOnWrongKey, call_route_message_on_wrong_key);
#endregion Submit Audio Files
#region Add Keypads
//
// Add Keypad Method 1 - VoiceMessage.AddKeypad(int key, string keypad1_route);
//
VoiceMessage.AddKeypad(1, keypad1_route);
//
// Add Keypad Method 2 - AddKeypad(new Keypad());
//
VoiceMessage.AddKeypad(new Keypad(2, keypad2_route));
//
// Add Keypad Method 3 - AddKeypad(new List<Keypad>())
//
List<Keypad> keypad_list = new List<Keypad>();
keypad_list.Add(new Keypad(3, keypad3_route));
//
// Add Keypad Method 4 - AddKeypad(new List<Keypad>()) using Keypad objects
//
Keypad keypad4 = new Keypad();
keypad4.Tone = 4;
keypad4.RouteNumber = keypad4_route;
keypad_list.Add(keypad4);
VoiceMessage.AddKeypads(keypad_list);
#endregion Add Keypads
#region Add Recipients
//
// Add Recipient Method 1 - AddRecipient(string recipient);
//
VoiceMessage.AddRecipient(recipient1);
//
// Add Recipient Method 2 - AddRecipient(new Recipient())
//
Recipient recipient = new Recipient(recipient2);
recipient.CompanyName = "Test Company"; // Company Name
recipient.Attention = "Test Recipient 2"; // Attention
recipient.Custom1 = "Custom1"; // Custom1
recipient.Custom2 = "Custom2"; // Custom2
recipient.Custom3 = "Custom3"; // Custom3
recipient.Custom4 = "Custom4"; // Custom4
recipient.Custom5 = "Custom5"; // Custom5
VoiceMessage.AddRecipient(recipient);
//
// Add Recipient Method 3 - AddRecipients(new List<Recipient>()); using simple destination
//
List<Recipient> recipients = new List<Recipient>();
recipients.Add(new Recipient(recipient3));
//
// Add Recipient Method 4 - AddRecipients(new List<Recipient>()) using Recipient objects
//
recipients.Add(new Recipient(
recipient4, // Recipient
"Test Company", // Company Name
"Test Recipient 4", // Attention
"Custom1", // Custom1
"Custom2", // Custom2
"Custom3", // Custom3
"Custom4", // Custom4
"Custom5" // Custom5
));
VoiceMessage.AddRecipients(recipients);
#endregion Add Recipients
MessageResult response = VoiceMessage.SendMessage();
if (response.Result == MessageResult.ResultCode.Success)
{
Console.WriteLine("Success - " + response.MessageID);
}
else
{
Console.WriteLine("Error - " + response.ErrorMessage);
}
}
}
}
| Parameter | Example Value | Description | |
|---|---|---|---|
| Sender | [email protected] | Sender value set up in Create a new API user token | |
| APIKey | ta8wr7ymd | APIKey value set up in Create a new API user token | |
| MessageToPeople | [Base64encoded data] | The audio data played if the call is answered by a human (WAV format, 16-bit, 8000hz) | |
| Recipient | +6495005001 | Sets single recipient. For more options, refer to Optional Parameter recipients section | |
| Parameter | Example Value | Description | |
|---|---|---|---|
| MessageID | ID12345 | Tracking ID or message description. Leave black if you want us to generate one. | |
| Reference | Test1 | Reference of your message | |
| SendTime | new DateTime() | Delay sending until the specified date/time (dd/mm/yyyy HH:mm in your local timezone, specified by your Sender setting or overridden using the TimeZone command) | |
| Timezone | New Zealand | Timezone specified using Windows timezone value (default set using Web Dashboard can be overridden here) See Microsoft Timezones (use the Country value) |
|
| SubAccount | SubAccount01 | Used for reporting, billing and Web Dashboard segmentation | |
| Department | Department01 | Used for reporting, billing and Web Dashboard segmentation | |
| ChargeCode | BillingGroup01 | Cost allocation for billing | |
| MessageToAnswerphones | [Base64encoded data] | The audio data played when the call is answered by an answering machine/voicemail service (WAV format, 16-bit, 8000hz) | |
| Keypads | > Tone | 1 | Keypad for call connection (supports buttons 1-9) |
| > RouteNumber | +64800123123 | Telephone number for call routing in dialling format | |
| CallRouteMessageToPeople | [Base64encoded data] | Audio data played when a keypad option is pressed (WAV format, 16-bit, 8000hz), eg "Connecting you now." | |
| CallRouteMessageToOperators | [Base64encoded data] | Audio data played to the call centre representative answering the connected call (WAV format, 16-bit, 8000hz), eg "Incoming Text To Speech call." | |
| CallRouteMessageOnWrongKey | [Base64encoded data] | Audio data played when an unregistered keypad button is pressed (WAV format, 16-bit, 8000hz), eg "Sorry, you have pressed an invalid key. Please try again" | |
| NumberOfOperators | 5 | Limits the maximum simultaneous calls (where multiple 'Destinations' are listed) | |
| CallerID | +6495005000 | Sets the Caller ID used on the call (must be E.164 format) | |
| Options | Customisable field | ||
| Recipients | > PhoneNumber | +6495005000 | Recipient of the call in E.164 internationalised format |
| > Attention | Recipient One | Recipient's friendly name | |
| > Company | Example Corp | Recipient's company | |
| > Custom1 | Recipient One | Customisable field | |
| > Custom2 | Recipient One | Customisable field | |
| Function | Usage | Description | |
|---|---|---|---|
| AddRecipient() |
AddRecipient(string recipient) AddRecipient(Recipient recipient) |
Function to add a single message recipient | |
| AddRecipients() |
AddRecipients(List<string> recipients) AddRecipients(List<Recipient> recipients) |
Function to add a list of message recipients | |
| AddKeypad() |
AddKeypad(int tone, string route_number) AddKeypad(Keypad keypad) |
Function to add a keypad option (init tone=keypad button, route_number=number to divert the call to) | |
| AddKeypads() | AddKeypads(List<Keypad> keypads) | Function to add a list of keypad options (init tone=keypad button, route_number=number to divert the call to) | |
| AddMessageData() | AddMessageData(MessageDataType message_data_type, string file_location) | Function to add a WAV audio file to the message (the .NET library will grab the file contents from the specified file location) | |
| SendMessage() |
SendMessage() SendMessage(string message_id, string reference, DateTime send_time, string timezone, string subaccount, string department, string charge_code, int number_of_operators, string caller_id, string options) SendMessage(string message_id, string reference, DateTime send_time, string timezone, string subaccount, string department, string charge_code, string message_to_people, string message_to_answerphones, string call_route_message_to_people, string call_route_message_to_operators, string call_route_message_on_wrong_key, int number_of_operators, string caller_id, string options) |
Function to submit messages to TNZ REST API Returns MessageResult object |
|
using TNZAPI.Messaging.Send;
namespace TNZTTSBasic
{
class Program
{
static void Main(string[] args)
{
TTS TTSMessage = new TTS();
TTSMessage.Sender = "[email protected]";
TTSMessage.APIKey = "15153";
TTSMessage.MessageToPeople = "Hello, this is a call from test. This is relevant information.";
TTSMessage.Recipient = "+6421452254";
TTSMessage.SendMessage();
}
}
}
using System;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Send;
namespace TNZTTSSimple
{
class Program
{
static void Main(string[] args)
{
const string sender = "YOUR_EMAIL_ADDRESS";
const string api_key = "YOUR_API_KEY";
const string recipient = "+6495005001";
const string message_to_people = "Hello, this is a call from test. This is relevant information.";
TTS TTSMessage = new TTS(sender, api_key);
TTSMessage.AddMessageData(TTS.MessageDataType.MessageToPeople, message_to_people);
TTSMessage.AddRecipient(recipient);
MessageResult response = TTSMessage.SendMessage();
if( response.Result == MessageResult.ResultCode.Success )
{
Console.WriteLine("Success - " + response.MessageID);
}
else
{
Console.WriteLine("Error - " + response.ErrorMessage);
}
}
}
}
using System;
using System.Collections.Generic;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Send;
namespace TNZTTSAdvanced
{
class Program
{
static void Main(string[] args)
{
const string sender = "[email protected]";
const string api_key = "ta8wr7ymd";
const string reference = "Test TTS - Advanced version";
const string caller_id = "+6495005000";
const string billing_account = "TEST BILLING ACCOUNT";
const string recipient1 = "+6421000001";
const string recipient2 = "+6495005002";
const string recipient3 = "+6495005003";
const string recipient4 = "+6495005004";
const string message_to_people = "Hello, this is a call from Department01. This is relevant information. Press one to be connected to our call centre.";
const string message_to_answerphones = "Hello, sorry we missed you. This is a call from Department 01. Please contact us on 0800 123123.";
const string call_route_message_to_people = "Connecting you now.";
const string call_route_message_to_operators = "Incoming Text To Speech call.";
const string call_route_message_on_wrong_key = "Sorry, you have pressed an invalid key. Please try again.";
const int number_of_operators = 1;
const TTS.TTSVoiceType tts_voice = TTS.TTSVoiceType.Female2;
const string keypad1_route = "+64800111111";
const string keypad2_route = "+64800222222";
const string keypad3_route = "+64800333333";
const string keypad4_route = "+64800444444";
TTS TTSMessage = new TTS(sender, api_key);
#region Call Options
TTSMessage.Reference = reference;
TTSMessage.CallerID = caller_id;
TTSMessage.SubAccount = billing_account;
TTSMessage.NumberOfOperators = number_of_operators;
#endregion Call Options
#region Submit TextToSpeech Messagess
//
// Submit TextToSpeech Messagess (Text format only)
//
TTSMessage.AddMessageData(TTS.MessageDataType.MessageToPeople, message_to_people);
TTSMessage.AddMessageData(TTS.MessageDataType.MessageToAnswerPhones, message_to_answerphones);
TTSMessage.AddMessageData(TTS.MessageDataType.CallRouteMessageToPeople, call_route_message_to_people);
TTSMessage.AddMessageData(TTS.MessageDataType.CallRouteMessageToOperators, call_route_message_to_operators);
TTSMessage.AddMessageData(TTS.MessageDataType.CallRouteMessageOnWrongKey, call_route_message_on_wrong_key);
#endregion Submit Audio Files
#region Add Keypads
//
// Add Keypad Method 1 - VoiceMessage.AddKeypad(int key, string keypad1_route);
//
TTSMessage.AddKeypad(1, keypad1_route);
//
// Add Keypad Method 2 - AddKeypad(new Keypad());
//
TTSMessage.AddKeypad(new Keypad(2, keypad2_route));
//
// Add Keypad Method 3 - AddKeypad(new List<Keypad>())
//
List<Keypad> keypad_list = new List<Keypad>();
keypad_list.Add(new Keypad(3, keypad3_route));
//
// Add Keypad Method 4 - AddKeypad(new List<Keypad>()) using Keypad objects
//
Keypad keypad4 = new Keypad();
keypad4.Tone = 4;
keypad4.RouteNumber = keypad4_route;
keypad_list.Add(keypad4);
TTSMessage.AddKeypads(keypad_list);
#endregion Add Keypads
#region Add Recipients
//
// Add Recipient Method 1 - AddRecipient(string recipient);
//
TTSMessage.AddRecipient(recipient1);
//
// Add Recipient Method 2 - AddRecipient(new Recipient())
//
Recipient recipient = new Recipient(recipient2);
recipient.CompanyName = "Test Company"; // Company Name
recipient.Attention = "Test Recipient 2"; // Attention
recipient.Custom1 = "Custom1"; // Custom1
recipient.Custom2 = "Custom2"; // Custom2
recipient.Custom3 = "Custom3"; // Custom3
recipient.Custom4 = "Custom4"; // Custom4
recipient.Custom5 = "Custom5"; // Custom5
TTSMessage.AddRecipient(recipient);
//
// Add Recipient Method 3 - AddRecipients(new List<Recipient>()); using simple destination
//
List<Recipient> recipients = new List<Recipient>();
recipients.Add(new Recipient(recipient3));
//
// Add Recipient Method 4 - AddRecipients(new List<Recipient>()) using Recipient objects
//
recipients.Add(new Recipient(
recipient4, // Recipient
"Test Company", // Company Name
"Test Recipient 4", // Attention
"Custom1", // Custom1
"Custom2", // Custom2
"Custom3", // Custom3
"Custom4", // Custom4
"Custom5" // Custom5
));
TTSMessage.AddRecipients(recipients);
#endregion Add Recipients
MessageResult response = TTSMessage.SendMessage(
"", // MessageID - Leave blank to auto-generate
reference, // Reference
new DateTime(), // SendTime
"New Zealand", // Timezone
billing_account, // Billing Account (SubAccount)
"", // Department
"", // ChargeCode
number_of_operators, // No of Operators - Limits the maximum simultaneous calls
caller_id, // Caller ID
tts_voice, // Text-to-Speech voice to use (Male1, Female1, Female2, Female3, Female4)
"" // Options
);
if (response.Result == MessageResult.ResultCode.Success)
{
Console.WriteLine("Success - " + response.MessageID);
}
else
{
Console.WriteLine("Error - " + response.ErrorMessage);
}
}
}
}
| Parameter | Example Value | Description | |
|---|---|---|---|
| Sender | [email protected] | Sender value set up in Create a new API user token | |
| APIKey | ta8wr7ymd | APIKey value set up in Create a new API user token | |
| MessageToPeople | Hello, this is a call from Department01. This is relevant information. Press one to be connected to our call centre. | The text-to-speech message played if the call is answered by a human | |
| Destinations | +6495005001 | Sets single recipient. For more options, refer to Optional Parameter recipients section | |
| Parameter | Example Value | Description | |
|---|---|---|---|
| MessageID | ID12345 | Tracking ID or message description. Leave black if you want us to generate one. | |
| Reference | Test1 | Reference of your message | |
| SendTime | new DateTime() | Delay sending until the specified date/time (dd/mm/yyyy HH:mm in your local timezone, specified by your Sender setting or overridden using the TimeZone command) | |
| Timezone | New Zealand | Timezone specified using Windows timezone value (default set using Web Dashboard can be overridden here) See Microsoft Timezones (use the Country value) |
|
| SubAccount | SubAccount01 | Used for reporting, billing and Web Dashboard segmentation | |
| Department | Department01 | Used for reporting, billing and Web Dashboard segmentation | |
| ChargeCode | BillingGroup01 | Cost allocation for billing | |
| MessageToAnswerphones | Hello, sorry we missed you. This is a call from Department 01. Please contact us on 0800 123123. | The text-to-speech message played when the call is answered by an answering machine/voicemail service | |
| Keypads | > Tone | 1 | Keypad for call connection (supports buttons 1-9) |
| > RouteNumber | +64800123123 | Telephone number for call routing in dialling format | |
| CallRouteMessageToPeople | Connecting you now. | Text-to-speech message played when a keypad option is pressed | |
| CallRouteMessageToOperators | Incoming Text To Speech call. | Text-to-speech message played to the call centre representative answering the connected call | |
| CallRouteMessageOnWrongKey | Sorry, you have pressed an invalid key. Please try again. | Text-to-speech message played when an unregistered keypad button is pressed | |
| NumberOfOperators | 5 | Limits the maximum simultaneous calls (where multiple 'Destinations' are listed) | |
| CallerID | 6495005000 | Sets the Caller ID used on the call (must be E.164 format) | |
| TTSVoice | TTSVoiceType.Female2 | Text-to-Speech voice to use (Male1, Female1, Female2, Female3, Female4) | |
| Options | Customisable field | ||
| Destinations | > PhoneNumber | +6495005000 | Recipient of the call in E.164 internationalised format |
| > Attention | Recipient One | Recipient's friendly name | |
| > Company | Example Corp | Recipient's company | |
| > Custom1 | Recipient One | Customisable field | |
| > Custom2 | Recipient One | Customisable field | |
| Function | Usage | Description | |
|---|---|---|---|
| AddRecipient() |
AddRecipient(string recipient) AddRecipient(Recipient recipient) |
Function to add a single message recipient | |
| AddRecipients() |
AddRecipients(List<string> recipients) AddRecipients(List<Recipient> recipients) |
Function to add a list of message recipients | |
| AddKeypad() |
AddKeypad(int tone, string route_number) AddKeypad(Keypad keypad) |
Function to add a keypad option (init tone=keypad button, route_number=number to divert the call to) | |
| AddKeypads() | AddKeypads(List<Keypad> keypads) | Function to add a list of keypads option (init tone=keypad button, route_number=number to divert the call to) | |
| AddMessageData() | AddMessageData(MessageDataType message_data_type, string tts_message) | Function to add Text-To-Speech content into message (text will be converted to speech) | |
| SendMessage() |
SendMessage() SendMessage(string message_id, string reference, DateTime send_time, string timezone, string subaccount, string department, string charge_code, int number_of_operators, string caller_id, TTSVoiceType tts_voice, string options) SendMessage(string message_id, string reference, DateTime send_time, string timezone, string subaccount, string department, string charge_code, string message_to_people, string message_to_answerphones, string call_route_message_to_people, string call_route_message_to_operators, string call_route_message_on_wrong_key, int number_of_operators, string caller_id, TTSVoiceType tts_voice, string options) |
Function to submit messages to TNZ REST API Returns MessageResult object |
|
To resend or retry sending a message via API, this will need to be submitted as a new, unique message.
To resend or retry sending a message via the Web Dashboard, once logged in and viewing an individual message, you will see Resubmit and Forward buttons.
Under Message object you can specify an additional SendMode=Test parameter.
SendMode=Test means any messages will be handled by the API, instantly called a SUCCESS and the success report will be delivered to you. This is a useful way to end-to-end test without sending a live message.
// For Email
EmailMessage.SendMode = Email.SendModeType.Test;
// For SMS
SMSMessage.SendMode = SMS.SendModeType.Test;
// For Fax
FaxMessage.SendMode = Fax.SendModeType.Test;
// For Voice
VoiceMessage.SendMode = Voice.SendModeType.Test;
// For TTS
TTSMessage.SendMode = TTS.SendModeType.Test;
Delivery Reports advise whether delivery was successful. If not, it will describe why.
Each delivery report type is optional and multiple delivery report times can be used.
You will be supplied with a Web Dashboard login at registration. The Dashboard can be used to set up new sender/token pairs, as well as track sent and replied messages. You can drill into specific messages to view individual events, such as delivery attempts, retries, replies, results, clicks, etc.
Delivery reports are emailed as an HTML email for viewing by an end-user. Your sales representative can enable this for you.
Whitelabelling of SMTP Email reports is available.
The email address to receive SMS Reply reports can be specified on the original message submission using the SMSEmailReply parameter.
To receive Delivery Reports via Webhook, please advise the URL to submit to.
Webhooks are provided as an HTTP POST in either XML or JSON format (your preference).
Supplied parameters are:
| Parameter | Example Value | Description |
|---|---|---|
| Sender | [email protected] | Webhook sender authentication (can configure a unique Sender if required) |
| APIKey | ta8wr7ymd | Webhook token authentication (can configure a unique APIKey if required) |
| Type | SMS | Type of Message ('Email', 'SMS', 'Fax', 'Voice', 'TextToSpeech', or 'SMSReply') |
| Destination | +6421000001 | Destination that the webhook is for (alphanumeric field, where telephone/mobile numbers are supplied in E.164 internationalised format) |
| MessageID | js82hn8n | MessageID parameter supplied when sending your original API call |
| JobNumber | 10C7B9A0 | Eight digit alphanumeric tracking number (our internal Job Number) |
| SentTime | 16/10/2018 13:43 p.m. | Time message was completed (Sender's local time time in 'dd/MM/yyyy HH:mm tt' format) |
| Status | SUCCESS | For submission results, values are SUCCESS, FAILED, PENDING For reply reports, this will be RECEIVED For additional analytics, this will be UPDATED |
| Result | Sent OK | Final delivery result and/or the cause for a message delivery failure For reply reports, this will be RECEIVED For additional analytics, this will be the event description |
| Message | This is a reply. | This field will only contain data if 'Type=SMSReply' |
| Price | 0.20 | Your cost for this transaction, charged by us to you |
| Detail | SMSParts:2 | Additional billing detail: "SMSParts", "FaxPages", "VoiceMinutes", "Size", "Prompts" |
API users able poll status of message (summary) through Get Status API.
Reference : TNZAPI.Messaging.Get
using System;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Get;
namespace TNZStatusPoll
{
class Program
{
static void Main(string[] args)
{
const string sender = "[email protected]";
const string api_key = "ta8wr7ymd";
const string message_id = "ID123456";
StatusRequest status_request = new StatusRequest(sender, api_key);
StatusResult status_result = status_request.Poll(message_id);
if( status_result.Result == StatusResult.ResultCode.Success )
{
Console.WriteLine("Status of MessageID '" + message_id + "':");
Console.WriteLine(" => Status: '" + status_result.GetStatusString() + "'");
Console.WriteLine(" => JobNum: '" + status_result.JobNum + "'");
Console.WriteLine(" => Account: '" + status_result.Account + "'");
Console.WriteLine(" => SubAccount: '" + status_result.SubAccount + "'");
Console.WriteLine(" => Department: '" + status_result.Department + "'");
Console.WriteLine(" => Count: " + status_result.Count.ToString());
Console.WriteLine(" => Complete: " + status_result.Complete.ToString());
Console.WriteLine(" => Success: " + status_result.Success.ToString());
Console.WriteLine(" => Failed: " + status_result.Failed.ToString());
}
else
{
Console.WriteLine("Cannot find MessageID '" + message_id + "' : '" + status_result.ErrorMessage + "'");
}
}
}
}
using System;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Get;
namespace TNZStatusPoll
{
class Program
{
static void Main(string[] args)
{
const string sender = "[email protected]";
const string api_key = "ta8wr7ymd";
const string message_id = "ID123456";
StatusRequest status_request = new StatusRequest(sender, api_key);
StatusResult status_result = status_request.Poll(message_id);
if( status_result.Result == StatusResult.ResultCode.Success )
{
Console.WriteLine("Status of MessageID '" + message_id + "':");
Console.WriteLine(" => Status: '" + status_result.GetStatusString() + "'");
Console.WriteLine(" => JobNum: '" + status_result.JobNum + "'");
Console.WriteLine(" => Account: '" + status_result.Account + "'");
Console.WriteLine(" => SubAccount: '" + status_result.SubAccount + "'");
Console.WriteLine(" => Department: '" + status_result.Department + "'");
Console.WriteLine(" => Count: " + status_result.Count.ToString());
Console.WriteLine(" => Complete: " + status_result.Complete.ToString());
Console.WriteLine(" => Success: " + status_result.Success.ToString());
Console.WriteLine(" => Failed: " + status_result.Failed.ToString());
}
else
{
Console.WriteLine("Cannot find MessageID '" + message_id + "' : '" + status_result.ErrorMessage + "'");
}
}
}
}
using System;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Get;
namespace TNZStatusPoll
{
class Program
{
static void Main(string[] args)
{
const string sender = "[email protected]";
const string api_key = "15153";
const string message_id = "AE8CB484-834E-DDD0-F326-B6575F53DA78";
StatusRequest status_request = new StatusRequest(sender, api_key);
StatusResult status_result = status_request.Poll(message_id);
if( status_result.Result == StatusResult.ResultCode.Success )
{
Console.WriteLine("Status of MessageID '" + message_id + "':");
Console.WriteLine(" => Status: '" + status_result.GetStatusString() + "'");
Console.WriteLine(" => JobNum: '" + status_result.JobNum + "'");
Console.WriteLine(" => Account: '" + status_result.Account + "'");
Console.WriteLine(" => SubAccount: '" + status_result.SubAccount + "'");
Console.WriteLine(" => Department: '" + status_result.Department + "'");
Console.WriteLine(" => Count: " + status_result.Count.ToString());
Console.WriteLine(" => Complete: " + status_result.Complete.ToString());
Console.WriteLine(" => Success: " + status_result.Success.ToString());
Console.WriteLine(" => Failed: " + status_result.Failed.ToString());
}
else
{
Console.WriteLine("Cannot find MessageID '" + message_id + "' : '" + status_result.ErrorMessage + "'");
}
}
}
}
| Parameter | Example Value | Description | |
|---|---|---|---|
| Sender | [email protected] | Sender value set up in Create a new API user token | |
| APIKey | ta8wr7ymd | APIKey value set up in Create a new API user token | |
| MessageID | ID123456 | Your provided Message ID or TNZ Group generated Message ID | |
Currently, tracking SMS Received is supported.
Tracking of faxes and voicemail received is scheduled for a future release. Let your account manager know if this interests you.
You will be supplied with a Web Dashboard login at registration. The Dashboard can be used to set up new sender/token pairs, as well as track sent and replied messages. You can drill into specific messages to view individual events, such as delivery attempts, retries, replies, results, clicks, etc.
Delivery reports are emailed as an HTML email for viewing by an end-user. Your sales representative can enable this for you.
Whitelabelling of SMTP Email reports is available.
When submitting SMS messages, specify the SMSEmailReply parameter.
If you are set up to receive Status webhooks, you will also be receiving SMS Received webhooks.
To receive SMS replies via Webhook, please advise the URL to submit to.
Webhooks are provided as an HTTP POST in either XML or JSON format (your preference).
Supplied parameters are:
| Parameter | Example Value | Description |
|---|---|---|
| Sender | [email protected] | Webhook sender authentication (can configure a unique Sender if required) |
| APIKey | ta8wr7ymd | Webhook token authentication (can configure a unique APIKey if required) |
| Type | SMSReply | Type of Message ('Email', 'SMS', 'Fax', 'Voice', 'TextToSpeech', or 'SMSReply') |
| Destination | +6421000001 | Destination that the webhook is for (alphanumeric field, where telephone/mobile numbers are supplied in E.164 internationalised format) |
| MessageID | js82hn8n | MessageID parameter supplied when sending your original API call |
| JobNumber | 10C7B9A0 | Eight digit alphanumeric tracking number (our internal Job Number) |
| SentTime | 16/10/2018 13:43 p.m. | Time message was completed (local time time in 'dd/MM/yyyy HH:mm tt' format) |
| Status | RECEIVED | For submission results, values are SUCCESS, FAILED, PENDING For reply reports, this will be RECEIVED For additional analytics, this will be UPDATED |
| Result | RECEIVED | Final delivery result and/or the cause for a message delivery failure For reply reports, this will be RECEIVED For additional analytics, this will be the event description |
| Message | This is a reply. | This field will only contain data if 'Type=SMSReply' |
| Price | 0.20 | Your cost for the outbound message sent, charged by us to you (no cost for the reply received) |
| Detail | SMSParts:2 | Additional billing detail: "SMSParts", "FaxPages", "VoiceMinutes", "Size", "Prompts" on the outbound message sent (not the SMS Received) |
API users able poll status of message (summary) through Get Status API.
Reference : TNZAPI.Messaging.Get
using System;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Get;
namespace TNZGetSMSReceived
{
class Program
{
static void Main(string[] args)
{
const string sender = "YOUR_EMAIL_ADDRESS";
const string api_key = "YOUR_API_KEY";
const string message_id = "ID12345";
SMSReceivedRequest sms_received = new SMSReceivedRequest(sender, api_key);
SMSReceivedResult sms_received_result = sms_received.Poll(message_id);
if (sms_received_result.Result == SMSReceivedResult.ResultCode.Success)
{
Console.WriteLine("Status of MessageID '" + message_id + "':");
Console.WriteLine(" => Status: '" + sms_received_result.GetStatusString() + "'");
Console.WriteLine(" => JobNum: '" + sms_received_result.JobNum + "'");
Console.WriteLine(" => Account: '" + sms_received_result.Account + "'");
Console.WriteLine(" => SubAccount: '" + sms_received_result.SubAccount + "'");
Console.WriteLine(" => Department: '" + sms_received_result.Department + "'");
Console.WriteLine("======================================");
Console.WriteLine(" => MessageSent");
Console.WriteLine(" -> Date: '" + sms_received_result.SentMessage.Date.ToString("yyyy-MM-dd hh:mm:ss") + "'");
Console.WriteLine(" -> Destination: '" + sms_received_result.SentMessage.Destination + "'");
Console.WriteLine(" -> MessageText: '" + sms_received_result.SentMessage.MessageText + "'");
foreach (SMSReceivedMessage received in sms_received_result.ReceivedMessages)
{
Console.WriteLine("======================================");
Console.WriteLine(" => MessageReceived");
Console.WriteLine(" -> Date: '" + received.Date.ToString("yyyy-MM-dd hh:mm:ss") + "'");
Console.WriteLine(" -> From: '" + received.From + "'");
Console.WriteLine(" -> MessageText: '" + received.MessageText + "'");
}
}
else
{
Console.WriteLine("Cannot find MessageID '" + message_id + "' : '" + sms_received_result.ErrorMessage + "'");
}
}
}
}
using System;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Get;
namespace TNZGetSMSReceived
{
class Program
{
static void Main(string[] args)
{
const string sender = "YOUR_EMAIL_ADDRESS";
const string api_key = "YOUR_API_KEY";
const string message_id = "ID12345";
SMSReceivedRequest sms_received = new SMSReceivedRequest(sender, api_key);
SMSReceivedResult sms_received_result = sms_received.Poll(message_id);
if (sms_received_result.Result == SMSReceivedResult.ResultCode.Success)
{
Console.WriteLine("Status of MessageID '" + message_id + "':");
Console.WriteLine(" => Status: '" + sms_received_result.GetStatusString() + "'");
Console.WriteLine(" => JobNum: '" + sms_received_result.JobNum + "'");
Console.WriteLine(" => Account: '" + sms_received_result.Account + "'");
Console.WriteLine(" => SubAccount: '" + sms_received_result.SubAccount + "'");
Console.WriteLine(" => Department: '" + sms_received_result.Department + "'");
Console.WriteLine("======================================");
Console.WriteLine(" => MessageSent");
Console.WriteLine(" -> Date: '" + sms_received_result.SentMessage.Date.ToString("yyyy-MM-dd hh:mm:ss") + "'");
Console.WriteLine(" -> Destination: '" + sms_received_result.SentMessage.Destination + "'");
Console.WriteLine(" -> MessageText: '" + sms_received_result.SentMessage.MessageText + "'");
foreach (SMSReceivedMessage received in sms_received_result.ReceivedMessages)
{
Console.WriteLine("======================================");
Console.WriteLine(" => MessageReceived");
Console.WriteLine(" -> Date: '" + received.Date.ToString("yyyy-MM-dd hh:mm:ss") + "'");
Console.WriteLine(" -> From: '" + received.From + "'");
Console.WriteLine(" -> MessageText: '" + received.MessageText + "'");
}
}
else
{
Console.WriteLine("Cannot find MessageID '" + message_id + "' : '" + sms_received_result.ErrorMessage + "'");
}
}
}
}
using System;
using TNZAPI.Messaging.Objects;
using TNZAPI.Messaging.Get;
namespace TNZGetSMSReceived
{
class Program
{
static void Main(string[] args)
{
const string sender = "YOUR_EMAIL_ADDRESS";
const string api_key = "YOUR_API_KEY";
const string message_id = "ID12345";
SMSReceivedRequest sms_received = new SMSReceivedRequest(sender, api_key);
SMSReceivedResult sms_received_result = sms_received.Poll(message_id);
if (sms_received_result.Result == SMSReceivedResult.ResultCode.Success)
{
Console.WriteLine("Status of MessageID '" + message_id + "':");
Console.WriteLine(" => Status: '" + sms_received_result.GetStatusString() + "'");
Console.WriteLine(" => JobNum: '" + sms_received_result.JobNum + "'");
Console.WriteLine(" => Account: '" + sms_received_result.Account + "'");
Console.WriteLine(" => SubAccount: '" + sms_received_result.SubAccount + "'");
Console.WriteLine(" => Department: '" + sms_received_result.Department + "'");
Console.WriteLine("======================================");
Console.WriteLine(" => MessageSent");
Console.WriteLine(" -> Date: '" + sms_received_result.SentMessage.Date.ToString("yyyy-MM-dd hh:mm:ss") + "'");
Console.WriteLine(" -> Destination: '" + sms_received_result.SentMessage.Destination + "'");
Console.WriteLine(" -> MessageText: '" + sms_received_result.SentMessage.MessageText + "'");
foreach (SMSReceivedMessage received in sms_received_result.ReceivedMessages)
{
Console.WriteLine("======================================");
Console.WriteLine(" => MessageReceived");
Console.WriteLine(" -> Date: '" + received.Date.ToString("yyyy-MM-dd hh:mm:ss") + "'");
Console.WriteLine(" -> From: '" + received.From + "'");
Console.WriteLine(" -> MessageText: '" + received.MessageText + "'");
}
}
else
{
Console.WriteLine("Cannot find MessageID '" + message_id + "' : '" + sms_received_result.ErrorMessage + "'");
}
}
}
}
| Parameter | Example Value | Description | |
|---|---|---|---|
| Sender | [email protected] | Sender value set up in Create a new API user token | |
| APIKey | ta8wr7ymd | APIKey value set up in Create a new API user token | |
| MessageID | ID123456 | Your provided Message ID or TNZ Group generated Message ID | |
As new versions of the APIs are released, this API reference guide will be updated to reflect the latest version and features supported:
API Version ChangeLog