Add a keyword to an existing virtual number.


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!


Parameter

Description

Requirement

 keywordThe first word of a text messageYES
 numberThe dedicated virtual number that the keyword belongs toYES
 referenceYour own reference (up to 100 characters)NO
 list_id
ID of a list to add respondents to, list ID's can be found in the title of a list or in the list page URL
NO
 welcome_messageSMS message to send to new membersNO
 members_messageSMS message to existing membersNO
 activateWhether to make the keyword active immediately.

Possible values:
true - activate immediately (default)
false - create the keyword but do not activate
NO
 forward_urlForward messages to a URLNO
 forward_emailForward messages to a set of email addressesNO
 forward_smsForward messages to a set of msisdnsNO


Example


curl https://api.transmitsms.com/add-keyword.json \
  -u 2e24c1cbdd987221e165d543f34b84bf:secret \
  -d 'keyword=NEWS' \
  -d 'reference=Gym news' \
  -d 'number=61491570156' \
  -d 'status=active' \
  -d 'billing_date=2013-05-21' \
  -d list_id=0 \
  -d "welcome_message=Welcome to Mike's gym news" \
  -d 'members_message=Thanks for your continued support' \
  -d 'forward_url=http://example.com/gym-promo' \
  -d 'forward_email=news@example.com,mike@example.com' \
  -d 'forward_sms=61491570157,61491570158


JSON Response

{
  keyword: "NEWS",
  reference: "Gym news",
  number: "61491570156",
  status: "active",
  billing_date: "2013-05-21",
  list_id: 0,
  welcome_message: "Welcome to Mike's gym news",
  members_message: "Thanks for your continued support",
  forward_url: "http://example.com/gym-promo",
  forward_email: "news@example.com,mike@example.com",
  forward_sms: "61491570157,61491570158"
}

XML Response

<?xmlversion="1.0"encoding="UTF-8"?>
<response>
  <keyword>NEWS</keyword>
  <reference>Gym news</reference>
  <number>61491570156</number>
  <status>active</status>
  <billing_date>2013-05-21</billing_date>
  <list_id>0</list_id>
  <welcome_message>Welcome to Mike&amp;#39;s gym news</welcome_message>
  <members_message>Thanks for your continued support</members_message>
  <forward_url>http://example.com/gym-promo</forward_url>
  <forward_email>news@example.com,mike@example.com</forward_email>
  <forward_sms>61491570157,61491570158</forward_sms>
</response>


PHP examples


<?php
 include '../../APIClient2.php';

 $api = new transmitsmsAPI('API_KEY', 'API_SECRET');
 
 $result = $api->addKeyword('KEYWORD', '6140000000', '', 1234,
    'hi there new member', 'hi, you are already registered');
 
if ($result->error->code == 'SUCCESS') {
    echo"Keyword added";

} else {
    echo"Error: {$result->error->description}";
}