We created a new viewing experience for our SMS API documentation. It's now all in one central location. Click here to check it out!

This method allows you to create (and optionally activate) keyword


You should already have a purchased response number.


Parameters:


  • number - integer - number on which you want to run keyword
  • keyword - string - the keyword. use * to catch all incoming messages.
  • name - string - name (reference) for the keyword
  • list_id - integer - list to add incoming recipients. REQUIRED for reply_message_dupe
  • reply_message - string - automatic response SMS for new incoming recipients.
  • reply_message_dupe - string - automatic response SMS for incoming recipients which are already in the list.
  • activate - boolean - flag to activate keyword right after creation. true by default.
  • pass_to_url - string - callback URL for responses.
  • pass_to_email - string - list of emails to forward response to. please use comma to separate multiple values.
  • pass_to_sms - string - list of numbers to forward response as SMS. please use comma to separate multiple values. please use numbers in international format.


Expected response:


  • ADDED - keyword was added but not activated
  • ACTIVATED - keyword was added and activated
  • LONGCODE_UNAVAILABLE - the number you're using doesn't exist or don't belong to you
  • DUPLICATE_KEYWORD - the keyword you provided already exists
  • OVER_LIMIT - you reached the limit of active keywords for your account
  • EMAIL_INVALID - you provided an invalid email
  • NUMBER_INVALID - you provided an invalid number
  • NUMBER_LOCAL - you provided a number in local format


 




 




XML Request Example


<?xml version='1.0'?>

<request>

	<version>0.4</version>

	<key>API_KEY</key>

	<secret>API_SECRET</secret>

	<method>keywords.add</method>

	<params>

		<number>6140000000</number>

		<keyword>DEMO</keyword>

		<reply_message>thank you for signing up</reply_message>

	</params>

</request>	







XML Response Example


<?xml version='1.0'?>

<xml>

	<method>keywords.add</method>

	<total>1</total>

	<time>2012-11-21 16:49:23 GMT</time>

	<timestamp>1353516563 GMT</timestamp>

	<data>

		<status>ACTIVATED</status>

		<id>148</id>

	</data>

</xml>







PHP Example


Download the PHP API Client


<?php



// change api key and secret to your own

$myAPIKey = "API_KEY";

$myAPISecret = "API_SECRET";



// include base class

require('APIclient.php');



// create new client object

$transmitsmsAPI = new transmitsmsAPI($myAPIKey, $myAPISecret);



// set some vars

$number=6140000000;

$keyword='my keyword';

$name='my keyword name';



// execute request

$methodResponse = $transmitsmsAPI->addKeyword($number, $keyword, 0, $name);



// parse response into xml object

$xml = @simplexml_load_string($methodResponse);



// an error has occurred (usually this is because the list name already exists)

if (property_exists($xml, 'error')) {

	echo "Keyword was not added: " . (string) $xml->error;

}

else {

	echo "Keyword has been added. ID is ".$xml->data->id;	

}



?>






GET Example


Using a URL based request system you can request this method by using the below URL - be sure to url encode all your variables!


http://burst.transmitsms.com/api-wrapper/keywords.add?apikey=API_KEY&apisecret=API_SECRET&number=SHARED_NUMBER&keyword=NEW_KEYWORD