Trumpia's API will enable users to create applications or integrate with the user's system with some of the services and features offered by Trumpia. Users will be able to synchronize a contact list or database with their Trumpia account as well as perform most of the common tasks such as sending messages or creating and setting up keywords. Trumpia's API also offers two way SMS communication by forwarding incoming text messages that start with a user's keyword to the user's server.
Our API is a set of web
pages (php) that you can call using the POST and GET methods of a form post or by constructing a query string on the URL. So any software or language that can submit a web form or call a URL and receive a response will be compatible with our API.
We will be updating and improving our API so please feel free to send us questions, comments, or feature requests and check our website for the latest version of this document as well as updates.
Getting Started
In order to use the API, you must obtain an API Key for your Trumpia account. To obtain a key, please contact us using the support request page after logging into your Trumpia account. All accounts requesting an API Key will be reviewed and upon approval an API Key will be issued. You must have a non-trial Trumpia Account to use the API. Please check our website for any changes in our application process.
Once you obtain an API Key, you will need to configure your account. Our API Account Management feature has not yet been released so this process will temporarily be done by a Trumpia Representative. To make any changes to your settings you can contact us through our support page from your Trumpia account.
If you are using two way SMS, you will need to setup a page where we can post incoming text messages to.
Using the API
Calling a Function
Each function in our API is basically a web page that you can call by a form submission using the POST or GET method or a direct http request with the parameters in the URL as a query string. The function page (.php files) will process the request and respond with an XML string.
NOTE: All function page names are completely in lower case. So the AddContact function would be addcontact.php.
Submitting a form using the POST method is recommended. The GET method and URL query string methods both expose data in the URL and also have a limit on the data that can be passed due to the limit on the length of a URL.
Example POST Method:
This html code will be running on the client's server.
All the API functions or web(php) pages will respond with an XML string as its content. An XML response will be returned regardless of success or failure. Each function may have different response fields and error codes so please be sure to read each function's documentation.
Example XML Response:
This is what the functions will return as the contents of the page called.
Our API allows two way communication for mobile text messages. When a user texts in a mobile keyword and an optional message, the text message can be forwarded to your server. Our system parses all incoming text messages and identifies the keyword and forwards to the keyword owner's server via HTTP GET.
There are many applications of this feature, including the ability to generate an automated response to a customer's text message based on the contents of the text message. You can also use this feature to trigger a procedure or some action on your servers whenever a customer sends a text message to your keywords.
Keywords can be setup from the web or the API and can be configured to accept a message after the keyword. So customers can text in the keyword followed by any message. This message is also forwarded to your server.
A simple example would be a search engine application where the keyword is "search" and the message would be the search criteria. Our system would forward this text message to the client's server and the client's server would run the query and send the results back to the customer using our API.
Setting Up Incoming SMS
To activate this service, you must have an active Trumpia account with the API setup. You will need to contact us and request this function so a representative can help you get things setup.
A URL need to be provided to which our servers will post the incoming keyword text messages. You can also adjust the settings to bypass or skip any of our current normal keyword sign up process.
Incoming SMS Settings:
Receiving URL - This is where our system will post the incoming keyword text messages.
Incoming Message - If you turn on this flag, our system will post xml messages to the Receiving URL.
Signup via Keyword - If you turn off this flag, you can skip the normal sign up process. Users will not be automatically added to the list in your Trumpia account.
Notification for Keyword Signup or Message - If you turn off this flag, you can skip the sending of notifications when there is a sign up for your account.
Auto-responder for Keyword Signup or Message - If you turn off this flag, you can skip sending of the automated response messages for keywords. This option is usually set if you are generating your own response in your API code.
Inbox for Keyword Messages - If you turn off this flag, you can skip storing the incoming keyword messages in your Trumpia Inbox.
Adds a new contact to contact list. A ContactID is returned which will be needed to update or delete the contact. There can be only one instance of a tool such as a mobile number on a list; however the same contact or some of the same contact information may exist on a different list.
NOTES: If you add the same contact info to different lists they will each be separate records with unique ContactID's. To copy, move, or other contact management, please go online to trumpia.com
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
FirstName
Required
First name of the contact.
LastName
Optional
Last name of the contact.
Email
Optional
Email address of the contact.
CountryCode
Default: 1
Mobile phone number's country code. If left blank then it will be
assumed to be a US number.
MobileNumber
No symbols or spaces
For US, the 10 digit number without the leading 0 or 1. For some
international numbers, the leading 0 or 1 must be omitted.
AIM
Optional
AOL Instant Messenger screen name
ListName
Required
List to add the contact to.
SendVerification
Default: FALSE
TRUE or FALSE. If set to true, this sends a verification message to each tool before they are added to your distribution list. If the tool is not verified, they will be marked as not verified and cannot be used. If set to false, the verification step is bypassed and contacts will be added directly into your distribution list. A verification is omitted for an international phone number (not US).
AllowAccessInfo
Default: TRUE
(Depreciated)
UseCustomMobileVerificationMessage
Default: FALSE
TRUE or FALSE. Send your custom verification message.
CustomMobileVerificationMessage
Optional
If UseCustomMobileVerificationMessage is TRUE, this message will be sent for the verification message. Limit 60 characters. Default Verification Message : Reply OK to start. Msg&Data rates may apply. Upto 30msg/mo.
Request Example
Response Example
1
AddContactToList
Adds an existing contact to a list using ContactID. You can copy the contact or use a pointer. Contacts with duplicate tool data cannot be added to the same list.
Setting the CreateCopy flag will create a new contact record and return a new ContactID. Adding the same contact to multiple lists allow for single update of the contact's data.
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
ContactID
Required
The contact to add.
ListName
Required
The list to add the contact to.
CreateCopy
Default: FALSE
By default, the same contact record is linked to the new list. Setting this to TRUE will create a new contact record and return a ContactID.
Request Example
Response Examples
Successful Response (CreateCopy : FALSE) :
1
Response Examples
Successful Response (CreateCopy : TRUE) :
1
Response Examples
Failed Responses:
00
GetContactData
This function returns the contact's information and tools registered along
with the tools verification status.
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
ContactID
Required
Unique ID of contact.
Request Example
Response Example
1
GetContactID
This function can be used to find a contact record within a list with an email address, phone number, or screen name. Only one contactID will be returned since a tool is unique within a list.
Whenever possible, a contact's ContactID should be stored locally to avoid having to call this function unnecessarily.
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
ListName
Required
List to search in
ToolType
Required (Integer)
Email : 1
Mobile Number : 2
AIM : 6
ToolData
Required
Email address, mobile number, or screen name depending on ToolType selected.
Request Example
Response Example
1
UpdateContactData
This function allows you to update an existing contact record. The ContactID must be provided and this is the only way to identify which contact to update. Keep in mind that the same contact record, a duplicate, can exist in multiple lists.
NOTES: Currently distribution lists that a contact belongs to cannot be updated through the API. Distribution list management must also be done online at trumpia.com
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
ContactID
Required
Unique ID of contact.
FirstName
Required
First name of the contact.
LastName
Optional
Last name of the contact.
Email
Optional
Email address of the contact.
CountryCode
Default: 1
Mobile phone number's country code. If left blank then it will be
assumed to be a US number.
MobileNumber
No symbols or spaces
For US, the 10 digit number without the leading 0 or 1. For some
international numbers, the leading 0 or 1 must be omitted.
AIM
Optional
AOL Instant Messenger screen name
SendVerification
Default: TRUE
TRUE or FALSE. Sends a verification to each tool before adding them. If a tool is not verified, they will be marked as not verified and cannot be used until it
is verified. A verification is omitted for an international phone number (not US).
AllowAccessInfo
Default: TRUE
(Depreciated)
UseCustomMobileVerificationMessage
Default: FALSE
TRUE or FALSE. Send your custom verification message.
CustomMobileVerificationMessage
Optional
If UseCustomMobileVerificationMessage is TRUE, this message will be sent for the verification message. Limit 60 characters. Default Verification Message: Reply OK to start. Msg&Data rates may apply. Upto 30msg/mo.
Request Example
Response Example
1
DeleteContact
This function deletes the contact from your contact list and any distribution
lists it was on.
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
ContactID
Required
Unique ID of contact.
Request Example
Response Example
01
RemoveContact
This function removes a contact by the actual contact information instead of the ContactID. This function is provided to easily remove subscriptions.
NOTE: If you omit a listname and set removeall to true, then all subscriptions associated with the tool will be deleted.
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the IP address.
tool
Required
Email address, mobile number, or screen name depending on ToolType selected.
tooltype
Required (Integer)
contact information type
1: email
2: mobile
6: aim
listname
Optional
Distribution list name - If no name is specified then the tool will be removed from all lists.
removeall
Optional(true,false) Default: false
By setting this flag to true, all other tools related to the specified tools will be deleted. In other words the whole subscription will be deleted.
Request Example
Example Response
01
SendToList
This function sends a message to all the contacts in the specified list. Email, SMS, IM or any combination can be sent with one function call using the Mode flags. Multiple lists can be selected by passing multiple list names separated by commas. Messages can also be scheduled for a later time using the SendLater flag and LaterTime field.
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
EmailMode
Required
TRUE or FALSE.
IMMode
Required
TRUE or FALSE.
SMSMode
Required
TRUE or FALSE.
SBMode
Required
TRUE or FALSE.
Description
Required
Description of message for your reference.
EmailSubject
If EmailMode/SBMode is TRUE, Required
Plain text.
EmailMessage
If EmailMode is TRUE, Required
Basic HTML supported for email contents.
IMMessage
If IMMode is TRUE, Required
Plain text. Character limit is 500 characters.
SMSMessage
If SMSMode is TRUE, Required
Plain text. Character limit is (132 - Lengths of Organization Name) characters.
* Characters Allowed
@
!
"
#
$
%
&
'
(
)
*
+
,
-
.
?
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
ChangeOrganizationName
If SMSMode is TRUE, Optional
This one-time-use organization name will temporarily override. - mobile text message structure <Organization Name>: <your text message content> Reply HELP for help
SBMessage
If SBMode is TRUE, Required
Plain text. Smart Blast.
ListNames
Required
name1,name2,name3...
AreaCode
Optional
areacode1,areacode2,areacode3...
MailMergeFirstName
Optional
Mail merge replacement for null values if email content contains mail merge variables.
MailMergeLastName
Optional
See Mail Merge feature online in compose email.
SendLater
Required
TRUE or FALSE.
LaterTime
Optional
YYYY-MM-DD HH:MM:SS (ex: 2009-04-22 14:10:32)
Request Example
Response Example
Successful Response:
1
Failed Responses: 00
SendToContact
This function allows sending a message to a single contact or several contacts using the ContactID numbers.
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
EmailMode
Required
TRUE or FALSE.
IMMode
Required
TRUE or FALSE.
SMSMode
Required
TRUE or FALSE.
SBMode
Required
TRUE or FALSE.
Description
Required
Description of message for your reference
EmailSubject
If EmailMode/SBMode is TRUE, Required
Plain text only.
EmailMessage
If EmailMode is TRUE, Required
Basic HTML supported for email contents.
IMMessage
If IMMode is TRUE, Required
Plain text. Character limit is 500 characters.
SMSMessage
If SMSMode is TRUE, Required
Plain text. Character limit is (132 - Lengths of Organization Name) characters.
* Characters Allowed
@
!
"
#
$
%
&
'
(
)
*
+
,
-
.
?
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
ChangeOrganizationName
If SMSMode is TRUE, Optional
This one-time-use organization name will temporarily override. - mobile text message structure <Organization Name>: <your text message content> Reply HELP for help
SBMessage
If SBMode is TRUE, Required
Plain text. Smart Blast.
ContactIDs
Required
ContactID1,ContactID2,ContactID3...
MailMergeFirstName
Optional
Mail merge replacement for null values if email content contains mail merge variables.
MailMergeLastName
Optional
See Mail Merge feature online in compose email.
Request Example
Response Example
Successful Response:
1
Failed Responses: 00
CheckKeyword
This function returns whether a keyword is available or not.
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
Keyword
Required
Keyword to check for availability
Request Example
Response Example
- Available
1AVAILABLE
- Unavailable 1UNAVAILABLE
CreateKeyword
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
Keyword
Required
The keyword to create. Check availability before creating.
ListNames
Required
name1,name2,name3...
NotifyEmail
Optional
Email address to where a notification will be sent when someone signs up via this keyword.
NotifyMobile
Optional
Mobile phones to where a notification will be sent when someone signs up via this keyword.
UserResponse
Required
TRUE or FALSE. This enables users to add a message or response after the keyword. This message will be sent to your Trumpia Inbox.
KeywordMessage
Required
The automated message to be sent to someone who texts in the keyword. Limit (132 - Lengths of Organization Name) characters.
* Characters Allowed
@
!
"
#
$
%
&
'
(
)
*
+
,
-
.
?
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
UseNotify
Default 'FALSE'
TRUE or FALSE. When someone texts in this keyword, send a notification.
NotifyType1
Default 'FALSE'
TRUE or FALSE. ( If UserResponse is TRUE and UseNotify is TRUE) Notify me when someone texts in this keyword without an optional message
NotifyType2
Default 'FALSE'
TRUE or FALSE. ( If UserResponse is TRUE and UseNotify is TRUE and NotifyType1 is TRUE) only when the keyword subscriber's mobile number is new to my contact database
NotifyType3
Default 'FALSE'
TRUE or FALSE. ( If UserResponse is TRUE and UseNotify is TRUE) Notify me when someone texts in this keyword with an optional message (example: "RADIO Jingle Bells")
NotifyType4
Default 'FALSE'
TRUE or FALSE. ( If UserResponse is TRUE and UseNotify is TRUE and NotifyType3 is TRUE ) only when the keyword subscriber's mobile number is new to my contact database
NotifyType5
Default 'FALSE'
TRUE or FALSE. ( If UserResponse is FALSE and UseNotify is TRUE) only when the keyword subscriber's mobile number is new to my contact database
SendAutoResponse
Default '2'
1 - Only once per mobile number
2 - Every time
3 - Only once every minute
4 - Only once every hour
5 - Only once every day
6 - Only once every week
7 - Only once every month
8 - Only once every year
SendAlternate
Default 'FALSE'
TRUE or FALSE. ( If SendAutoResponse is not '1') Send an alternate Auto-responder after the first time. (Send this only if the subscriber already exists in your contact database.)
AlternateMessage
Optional
Limit (132 - Lengths of Organization Name) characters.
* Characters Allowed
@
!
"
#
$
%
&
'
(
)
*
+
,
-
.
?
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
ChangeOrganizationName
Optional
This Organization Name will override the default Organization Name in the KeywordMessage and AlternateMessage responses.
Request Example
Response Example
1
UpdateKeyword
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
Keyword
Required
The keyword to update. This must be keyword setup on your account.
ListNames
Required
name1,name2,name3...
NotifyEmail
Optional
Email address to where a notification will be sent when someone signs up via this keyword.
NotifyMobile
Optional
Mobile phones to where a notification will be sent when someone signs up via this keyword.
UserResponse
Required
TRUE or FALSE. This enables users to add a message or response after the keyword. This message will be sent to your Trumpia Inbox.
KeywordMessage
Required
The automated message to be sent to someone who texts in the keyword. Limit (132 - Lengths of Organization Name) characters.
* Characters Allowed
@
!
"
#
$
%
&
'
(
)
*
+
,
-
.
?
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
UseNotify
Default 'FALSE'
TRUE or FALSE. When someone texts in this keyword, send a notification.
NotifyType1
Default 'FALSE'
TRUE or FALSE. ( If UserResponse is TRUE and UseNotify is TRUE) Notify me when someone texts in this keyword without an optional message
NotifyType2
Default 'FALSE'
TRUE or FALSE. ( If UserResponse is TRUE and UseNotify is TRUE and NotifyType1 is TRUE) only when the keyword subscriber's mobile number is new to my contact database
NotifyType3
Default 'FALSE'
TRUE or FALSE. ( If UserResponse is TRUE and UseNotify is TRUE) Notify me when someone texts in this keyword with an optional message (example: "RADIO Jingle Bells")
NotifyType4
Default 'FALSE'
TRUE or FALSE. ( If UserResponse is TRUE and UseNotify is TRUE and NotifyType3 is TRUE ) only when the keyword subscriber's mobile number is new to my contact database
NotifyType5
Default 'FALSE'
TRUE or FALSE. ( If UserResponse is FALSE and UseNotify is TRUE) only when the keyword subscriber's mobile number is new to my contact database
SendAutoResponse
Default '2'
1 - Only once per mobile number
2 - Every time
3 - Only once every minute
4 - Only once every hour
5 - Only once every day
6 - Only once every week
7 - Only once every month
8 - Only once every year
SendAlternate
Default 'FALSE'
TRUE or FALSE. ( If SendAutoResponse is not '1') Send an alternate Auto-responder after the first time. (Send this only if the subscriber already exists in your contact database.)
AlternateMessage
Optional
Limit (132 - Lengths of Organization Name) characters.
* Characters Allowed
@
!
"
#
$
%
&
'
(
)
*
+
,
-
.
?
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
ChangeOrganizationName
Optional
This Organization Name will override the default Organization Name in the KeywordMessage and AlternateMessage responses.
Request Example
Response Example
1
DeleteKeyword
This function deletes the specified keyword from your account.
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
Keyword
Required
The mobile keyword you wish to delete.
Request Example
Response Example
1
CreateList
This function creates a list.
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
ListName
Required
A list name you wish to create. Only alphanumeric characters are allowed. case insensitive. The maximum length for a list name is 32 characters.
DisplayName
Required
The display name will be the name that your contacts will see when signing up for your distribution lists. The public will be able to see this name, so make sure it will make sense to your future contacts.
Frequency
Required
The frequency of messages your subscribers receive each month must be disclosed by mobile industry regulations.
Description
Required
The description of the nature of messages your subscribers will receive when opted into this list must be disclosed.
Request Example
Response Example
1
RenameList
This function renames an existing distribution list.
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
ListName
Required
The distribution list to be renamed.
NewListName
Required
The new name the distribution list will be changed to.
DisplayName
Required
The display name will be the name that your contacts will see when signing up for your distribution lists. The public will be able to see this name, so make sure it will make sense to your future contacts.
Frequency
Required
The frequency of messages your subscribers receive each month must be disclosed by mobile industry regulations.
Description
Required
The description of the nature of messages your subscribers will receive when opted into this list must be disclosed.
Request Example
Response Example
1
DeleteList
This function deletes a list.
Parameter
Description
APIKEY
Required
Your unique API key must be passed in. This will be matched with the
IP address.
ListName
Required
The list name you wish to delete.
DeleteContact
Default 'FALSE'
TRUE or FALSE. Entire contact in entered list will deleted. After doing this, you can't restore data.