Create tagg


Developers may want to dynamically create taggs without visiting tagga.com. This feature is particularly useful for applications containing groups of users who would benefit from newsletter taggs.

POST URL:
http://tagga.com/api/create/

POST Parameters:

  1. apikey - Developer API key, retrieve from API account at tagga.com
  2. passkey - Developer Password key, emailed to developer when API account approved
  3. tagg - Defines the tagg (e.g. Text 'tagg' to 82442), must be 4-10 characters in length, and only contains alpha-numeric characters (a-z and/or 0-9, (Optional field - we autogenerate tagg if it is not provided)
  4. title - Title of the tagg, a required field, can be up to 100 characters in length
  5. message - The SMS message to send, a required field, maximum of 80 characters for non-paid SMS messages and 120 characters for paid SMS messages
  6. url - This will show up as a clickable link on tagga's tagg pages (or straight pass through from sms if selected), maximum character length is 255 character, must be valid url (Optional)
  7. direct_url - Option to have tagga URL in SMS pass directly through to specified URL, options are TRUE or FALSE, TRUE requires that a URL be specified (Optional - default is FALSE)
  8. logo - This will show up in place of tagga's logo on the tagg pages (only if paid), maximum character length is 255 character, must be valid url to an image (Optional)
  9. address - Valid address that will display on tagg pages as a google map, maximum size is 255 character (Optional)
  10. paid - Set to TRUE to make tagg sponsor-free text message, FALSE otherwise. Setting to TRUE requires that developer have valid payment (Optional)
  11. daily_budget - Maximum daily budget for paid taggs (use this in conjunction with paid), this must be an integer value, no smaller, than 5 (Optional, but required if paid set to TRUE)
  12. detailed_info - More detailed info to describe tagg, viewable on tagga, maximum character length is 255 characters (Optional)
  13. keywords - Keywords to describe tagg, searchable on tagga. Separate the phrases/words with comma, maximum character length is 255 characters (Optional)
  14. image_url_1 - Image URL, will be viewable on tagg pages, maximum character length is 255 characters, must be valid url pointing to an image (Optional)
  15. image_url_2 - Image URL, will be viewable on tagg pages, maximum character length is 255 characters, must be valid url pointing to an image (Optional)
  16. image_url_3 - Image URL, will be viewable on tagg pages, maximum character length is 255 characters, must be valid url pointing to an image (Optional)
  17. image_url_4 - Image URL, will be viewable on tagg pages, maximum character length is 255 characters, must be valid url pointing to an image (Optional)
  18. image_url_5 - Image URL, will be viewable on tagg pages, maximum character length is 255 characters, must be valid url pointing to an image (Optional)
  19. private - When set to TRUE, tagg will not be viewable on tagga.com, but will be accessible via text messages. (Optional - Default is FALSE)
  20. newsletter - When set to TRUE, tagg is of newsletter tagg type, meaning users who request this tagg receive updates when tagg content updated. (Optional - Default is FALSE)

Restrictions:

  1. Developer can only create a tagg every ten minutes (or configurable on a developer basis, contact us).
  2. Developer must make a payment at tagga.com to pay for paid taggs.

Response:
An XML response is returned and details a unique transaction ID, response code, response message and the tagg variable (if successful). You are responsible for checking the response message and acting appropriately.

Back to top

PHP


$postdata = http_build_query(
  array(
    'apikey' => 'abc123', // put your API key here
    'passkey' => '321cba', // put your API password key here
    'tagg' => 'sometagg', // the tagg you have reserved for this application
    'title' => 'Sample Tagg Title', // New tagg title
    'message' => 'This is the text message for my newly created tagg.',
    'url' => 'http://www.tagga.com', // URL appears on tagg web pages.
    'paid' => 'TRUE', // Paid taggs get 40 extra characters and are ad free.
    'daily_budget' => '100', // Set daily budget for paid taggs.
    'detailed_info ' => 'So much detail and additional information.',
    'image_url_1' => 'http://www.tagga.com/img/image-1.jpg',
    'newsletter' => 'TRUE' // Updates are sent to all subscribers.
  )
);

$opts = array(
  'http' => array(
    'method' => 'POST',
    'header' => 'Content-type: application/x-www-form-urlencoded',
    'content' => $postdata
  )
);

$context = stream_context_create($opts);
$response = file_get_contents(
  'http://tagga.com/api/create/',
  false,
  $context
);

// handle the response message


Python


import urllib

apikey = u'abc123' # put your API key here
passkey = u'321cba' # put your API password key here
tagg = u'sometagg' # the tagg you have reserved for this application
title = u'Sample Tagg Title' # New tagg title
message = u'This is the text message for my newly created tagg.'
url = u'http://www.tagga.com' # URL appears on tagg web pages.
paid = u'TRUE' # Paid taggs get 40 extra characters and are ad free.
daily_budget = u'100' # Set daily budget for paid taggs.
detailed_info = u'So much detail and additional information.',
image_url_1 = u'http://www.tagga.com/img/image-1.jpg',
newsletter = u'TRUE' # Updates are sent to all subscribers.

postdata = urllib.urlencode({'apikey': apikey, 'passkey': passkey, 'tagg': tagg, 'title': title, 'message': message, 'url': url, 'paid': paid, 'daily_budget': daily_budget, 'detailed_info': detailed_info, 'image_url_1': image_url_1, 'newsletter': newsletter})

response = urllib.urlopen('http://tagga.com/api/create/', postdata)

# handle the response message


Java


try {

  String postdata = URLEncoder.encode("apikey", "UTF-8") + "=" + URLEncoder.encode("abc123", "UTF-8");
  postdata += "&" + URLEncoder.encode("passkey", "UTF-8") + "=" + URLEncoder.encode("321cba", "UTF-8");
  postdata += "&" + URLEncoder.encode("tagg", "UTF-8") + "=" + URLEncoder.encode("sometagg", "UTF-8");
  postdata += "&" + URLEncoder.encode("title", "UTF-8") + "=" + URLEncoder.encode("Sample Tagg Title", "UTF-8");
  postdata += "&" + URLEncoder.encode("message", "UTF-8") + "=" + URLEncoder.encode("This is the text message for my newly created tagg.", "UTF-8");
  postdata += "&" + URLEncoder.encode("url", "UTF-8") + "=" + URLEncoder.encode("http://www.tagga.com", "UTF-8");
  postdata += "&" + URLEncoder.encode("paid", "UTF-8") + "=" + URLEncoder.encode("TRUE", "UTF-8");
  postdata += "&" + URLEncoder.encode("daily_budget", "UTF-8") + "=" + URLEncoder.encode("100", "UTF-8");
  postdata += "&" + URLEncoder.encode("detailed_info", "UTF-8") + "=" + URLEncoder.encode("So much detail and additional information.", "UTF-8");
  postdata += "&" + URLEncoder.encode("image_url_1", "UTF-8") + "=" + URLEncoder.encode("http://www.tagga.com/img/image-1.jpg", "UTF-8");
  postdata += "&" + URLEncoder.encode("newsletter", "UTF-8") + "=" + URLEncoder.encode("TRUE", "UTF-8");

  // Send data
  URL url = new URL("http://tagga.com/api/create/");
  URLConnection conn = url.openConnection();
  conn.setDoOutput(true);
  OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
  wr.write(postdata);
  wr.flush();

  // Get the response
  BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));

  // handle the response here
  wr.close();
  rd.close();
} catch(Exception exc) {

  // handle any exceptions
}


Back to top

Sample Success Response


<?xml version="1.0" encoding="UTF-8"?>
<TaggaResponse version="1.0">
  <TransactionID>100</TransactionID>
  <ReturnCode>0</ReturnCode>
  <Message>Success - API function call successful</Message>
  <Tagg>sometagg</Tagg>
</TaggaResponse>

Sample Error Response


<?xml version="1.0" encoding="UTF-8"?>
<TaggaResponse version="1.0">
  <TransactionID>101</TransactionID>
  <ReturnCode>6</ReturnCode>
  <Message> Invalid Input - Some or all of the required parameters are invalid</Message>
</TaggaResponse>

Back to top
0: Success - API function call successful
2: Authentication Failed - apikey and passkey not valid
3: Incomplete API Call - Not all required parameters passed in
5: Message Length Invalid - Message text must be between 0 and 100 characters for the latin character set, and 0 and 50 for all others
6: Invalid Input - Some or all of the required parameters are invalid
7: Unknown Remote Address - This IP address is not allowed
11: Title too long - Title text must be between 0 and 100 characters
16: Tagg Unavailable - The requested tagg is already in use
17: Create Frequency Exceeded - You have exceeded the create frequency for this account
18: No Valid Payment Found - Campaign not created or message not sent, no valid payment found

Back to top