TrueDialog API
API Documentation
The TrueDialog API allows you to send messages from within your website or app and provides callbacks, contact management/filtering, and more. The following is an overview of the API, explaining its main features and variables. For more in-depth information about each endpoint, see the API Endpoints documentation.
All the URLs referenced in the instructions are based on the same Base URL https://api.truedialog.com/api/v2.1
Resources
The core features of any RESTful API are the resources themselves. This table outlines the resources necessary to use the API effectively. For more information on implementation, refer to the Endpoints section.
| Name | Description |
|---|---|
| Account | The top-level resource from which all API requests are made. |
| Subscription | This is what your customers opt in and out of. Most accounts only have one or a small number of subscriptions. A subscription is required before sending any messages. |
| Campaign | Contains information on messages to send. Several campaign types exist. |
| Content & Content Templates | Multi-channel and multi-language message templates. A Template campaign can have one Content Template for each supported channel and language. |
| Contact | The subscriber receiving the message, including contact information (phone number and/or email) and subscriber channel preferences. |
| Contact Attributes | Each account can create custom contact attributes to mimic (or build) their customer database. Attributes may be used in message templates and in ContactLists to create targeted contact filters. |
| Contact List | A sophisticated static/dynamic list used to group Contacts. A container for a set of filters that are evaluated at the time a campaign is sent. |
| Channel | A communication/transport channel. TrueDialog currently supports SMS, MMS, and Email channels. |
| Keyword | For SMS, participants use Keywords to text into a campaign. Primarily used on shared short codes, they can also be used on dedicated codes to distinguish which promotion a participant is responding to. |
Accounts
| Type | Description |
|---|---|
| Subaccounts | Subaccounts isolate campaign and contact information for all contacts within the subaccount. Subaccounts can be created with the Portal or API. |
| UAT | User Acceptance Testing accounts can be used for API integration testing before going live or for after-sales use. |
| Demo | Demo accounts may be used for pre-sales client-specific capability demonstrations. |
Subscriptions
A Subscription ID is required for the API to track the contact’s opt-in/opt-out status for campaigns.
One-time subscriptions are useful for sending one-time messages. Examples: “Your package has been delivered”, “Your appointment is at 12 pm”.
Recurring subscriptions are for sending ongoing communications (e.g., “Thanks for joining our program, here’s this week’s coupon”, “This week’s special is the tomato soup”, “We are having a big sale next month”). This type of subscription is commonly used for mobile marketing campaigns.
NOTE: When a new account is created, a recurrent subscription is also created.
Synchronization
Contact
You should regularly synchronize any information you have for a contact/customer (i.e., FirstName, LastName, ZipCode, etc.) with the TrueDialog system. All contact information is stored as “Contact Attributes” in our system/API. While the API allows you to merge all contact information, it is recommended that you merge only recently changed data.
NOTE: This can be done at the PROD account level, so that all linked accounts are synchronized regularly via a single API call or similar process.
Account
“Account Attributes” are primarily used by customers with multiple subaccounts to represent their various business locations or divisions. These attributes can be synchronized through the API, and the synchronization frequency depends on the specific use case. Generally, 24 hours is sufficient time for synchronization to occur.
Segmentation
- We allow segmentation based on any contact attribute or account attribute.
- All lists are dynamic. When a message is sent, a filtering criterion is executed to determine the current list of contacts.
Campaigns
- Messages can be sent via a Gateway Campaign, where the message body is delivered to us via the API. One API request delivers the message to a single phone number or a list of contacts.
- Messages can be sent via a Basic Campaign, where the message body is stored in a template. One API request delivers the message to a list of contacts.
- Basic messages can contain dynamic content via a Razor template that pulls in both Account Attribute data (specific to the subaccount, such as LocationCity) and Contact Attribute data (specific to the individual contact, such as FirstName).
Gateway Campaigns
Gateway Campaigns are the most basic type of campaign. They have no predefined content and require you to supply the message when you push the campaign. To create this type of campaign, all that is needed is the Campaign Name (Name) and the Campaign Type ID (campaignTypeId), which is 0. Once the campaign is created, the Campaign ID (id) is used whenever you push a new message with the campaign.
Campaign Types
TrueDialog supports a variety of campaign types.
If you need further assistance, Contact Us to discuss your requirements so we can help you determine the best approach.
Below is a list of supported Campaign Types with their API values.
| ID | Name | Description |
|---|---|---|
| 0 | Gateway | API-only campaign type used to send single-channel, single-language SMS messages, with the message text passed through every request. Not recommended when pushing to over 500 contacts. |
| 1 | Basic | The most common campaign. Message content is stored in the campaign and sent to a list of contacts passed through the request, or to a predefined ContactList for large pushes. |
| 2 | Dialog | Dialog asks the subscriber one or more questions and listens for their response. Responses are stored as contact attributes. Dialogs can be yes/no, multiple choice, or validated open responses. |
| 3 | Coupon | Similar to a Basic campaign but will include a static or system-generated unique coupon code in the message, an external list coupon code, or a shortened URL to a barcode coupon. |
Channel Types
The TrueDialog Platform supports messaging over multiple channels. If you require a channel that is not listed, Contact Us to discuss your unique requirements.
Below is a list of supported Channel Types with their API values.
| ID | Name | Description |
|---|---|---|
| 0 | SMS | SMS messages go out over a short code (e.g., 33898) or a Long Code (e.g., +19103755141). SMS messages in the United States must be 160 characters or less. |
| 1 | MMS | MMS messages are sent via a short code (e.g., 70626). |
| 2 | Email channels can be set up for any SMTP server. By default, we will send emails using Amazon SES. |
Encoding Types
Content templates can be encoded as plain text or in a C# Razor template compiled at runtime.
Below is a list of supported Message Encoding Types with their API values.
| ID | Name | Description |
|---|---|---|
| 0 | Text | Plain text: no encoding or dynamic text. |
| 1 | Razor | Required for emails. Can use dynamic text (contact attributes or account attributes) in messages. |
Schedule Types
Any campaign can be sent immediately or scheduled for a future time. The API also supports recurring scheduling.
To send a message immediately, set the execute variable to true in the Creates a new push action request body.
Below is a list of supported Schedule Types with their API values.
| ID | Name | Description |
|---|---|---|
| 2 | One Time | Trigger the action at a specified time in the future. |
| 6 | Daily | Trigger the action at a specified time every day. |
| 7 | Weekly | Trigger the action at a specified time on specified days of the week. |
| 8 | Monthly | Trigger the action at a specified time on specified days of the month. |
Language Types
Below is a list of supported Languages with their API values.
| ID | Language |
|---|---|
| 0 | English |
| 1 | Spanish |
| 2 | Simplified Chinese |
| 3 | French |
| 4 | Arabic |
| 5 | Nepali |
| 6 | Burmese |
| 7 | Somali |
Data Types
Below is a list of supported Data Types with their API values.
| ID | Name | Description |
|---|---|---|
| 1 | Integer | Whole number {0,1,2,3… or -1, -2, -3}. |
| 2 | String | Text information. |
| 3 | Real Number | Number with decimal {1.732, etc.}. |
| 4 | Date | Date or Datetime value. |
| 5 | Boolean | True or False |
| 6 | Binary | Binary data, such as an image or other file |
| 7 | GUID | Globally unique identifier {e.g., 8D796643-F9AE-4BE6-846C-B44EB9124DE9} |
| 8 | BigInt | Large whole number {0,1,2,3… or -1, -2, -3} |
Date and Time Formats
While the TrueDialog API can read many different Date/Time formats, we recommend using ISO 8601 format for best support. Below are some examples of valid date/time strings.
A string with a date and time component:
"2013-04-01T12:31:00.0000Z"
"2013-04-01T12:31:00.0000-05:00"A string that includes the GMT designator and conforms to RFC 1123:
"Mon, 01 Apr 2013 12:31:00 GMT"A string that includes the date and time in addition to the time zone offset:
"04/01/2013 12:31:00 -5:00"A string with a date but no time. The time component will default to 12:00 midnight.
A time with no date. The default date will be the current date.
Process Statuses
Process statuses indicate the current state of a campaign push or action. Below is a list of the Process Statuses with their API values.
| ID | Name |
|---|---|
| 0 | Pending |
| 1 | Processing |
| 2 | Completed |
| 3 | Aborted |
| 4 | Failed |
| 5 | Waiting Approval |
| 6 | Declined |
HTTP Response Codes
TrueDialog uses the following HTTP response/error codes. Error codes are returned with Content-Type=text/plain.
| ID | Response | Description |
|---|---|---|
| 200 | OK | The request was received successfully. |
| 201 | Created | The resource was created successfully via POST. |
| 204 | No Content | The request was processed successfully, but there was no content to return. |
| 400 | Bad Request | The request was malformed or missing required information. |
| 401 | Not Authorized | The authenticated user is not authorized to access the resource. |
| 404 | Not Found | The requested resource is not found or not accessible to the user. |
| 405 | Method Not Allowed | The requested resource does not support the HTTP method attempted. See Endpoints for a full list of which methods are supported on all resources. |
| 415 | Unsupported Media Type | The TrueDialog Web API supports XML (application/xml) and JSON (application/json) content types. A user may see this error if a different media type is requested in the Accept or Content Type headers. |
| 500 | Server Error | See message body for further details. Sometimes this occurs when the request body cannot be parsed. If noticed repeatedly, please contact TrueDialog so we can investigate the issue. |
| 503 | Service Unavailable | See message body for further details. Sometimes, this occurs when the server is temporarily unable to handle the request. This may be due to the server being overloaded or down for maintenance. Please contact TrueDialog so we can investigate the issue. |