Overview

This method enables Create, Update, and Delete a Keyword in a particular group.

Syntax

C#

[OperationContractAttribute()] 
SBT.API.DataContracts.Common.WSKeywordResponse ManageKeyword( 
string securityToken,   SBT.API.DataContracts.Admin.KeywordRequest keywordRequest

 )

 

WSDL

Production: https://ui.solutionsbytext.com/SBT.App.SetUp/WSServices/KeywordWSService.svc?singlewsdl

Staging: https://test.solutionsbytext.com/SBT.App.SetUp/WSServices/KeywordWSService.svc?singlewsdl

 

Parameters

securityToken

– String[1000] (Required) – SecurityToken to authenticate the user.

keywordRequest

– SBT.DataContracts.Admin.KeywordRequest (Required) – Keyword Object Parameters

* groupCode – String[50] (Required) – Default Organization Code for the group.

* Keyword – String[20] (Required) – Keyword name.

* note – String[20] (Optional) – Custom note for keyword.

* isautosubscribe – String[2] (Optional) – Option for setting autosubscribe ON/OFF. 0=OFF and 1=ON.

* keywordRequestType – String[2] (Optional) – 0 = CREATE, 1 = MODIFY, 2 = DELETE the keyword. If this field is blank then default option is CREATE.

* subscribed_response – String[160] (Optional – But when ‘isautosubscribe’ field is ‘1’, then this field is Required) – Already subscribed Response message for Keyword.

* notifylistemail – String[160] (Optional) – Keyword notification email list. Multiple emails should be comma separated.

* notifylistphone – String[160] (Optional) – Keyword notification phone number list. Multiple phone numbers should be comma separated.

 

Return Value

WSKeywordResponse
NAME TYPE DESCRIPTION

ErrorCode

int

For Success/Failure it returns an error number.

Message

string

Message related to error code.

Keyword

string

Created/Modified/Deleted Keyword Name

communicationCode

string

Created/Modified/Deleted communication code

result

string

True/False whether the call was successful or not.

 

Examples

C#

Keyword.KeywordClient  keywordService  = new KeywordClient("Keyword");
        keywordRequest keywordRequest = new keywordRequest();              
		 string securityToken = "SecurityToken";
		 keywordRequest.groupCode  = "groupCode";
		 keywordRequest.lblError.Text = "";
KeywordClient keywordService = new KeywordClient("KeywordWSServiceHttpEndpoint");
    string securityToken = txtToken.Text; ;

KeywordRequest keywordRequest = new KeywordRequest();

    keywordRequest.groupCode = txtGrpCode.Text.Trim();
    keywordRequest.Keyword = txtKeyword.Text.Trim();
    keywordRequest.note = txtNote.Text.Trim();
    keywordRequest.response = txtResponse.Text.Trim();
        if(chkisAutoSub.Checked)
            {
                keywordRequest.isautosubscribe = "1";
                keywordRequest.subscribed_response = txtSubscribedResponse.Text.Trim();
            }                
        else
                keywordRequest.isautosubscribe = "0";

    keywordRequest.keywordRequestType = txtKeywordRequestType.Text.Trim();
        if(txtNotifyListEmail.Text.Trim() != string.Empty)
                keywordRequest.notifylistemail = txtNotifyListEmail.Text.Trim();

        if (txtNotifyListPhone.Text.Trim() != string.Empty)
                keywordRequest.notifylistphone = txtNotifyListPhone.Text.Trim();            

    WSKeywordResponse wSKeywordResponse = keywordService.ManageKeyword(securityToken, keywordRequest);

        if (!wSKeywordResponse.result)
            {
                //handle error
                lblError.Text = wSKeywordResponse.message;
            }
        else
            {
                //handle success
                lblError.Text = wSKeywordResponse.message;
            }Keyword  = "Keyword";
		 keywordRequest.note  = "note";  
		 keywordRequest.response   = "response";
		 keywordRequest.isautosubscribe  = "0";  
		 keywordRequest.keywordRequestType = "0";
		 keywordRequest.subscribed_response   = "subscribed_response";
		 keywordRequest.notifylistemail   = "[email protected],[email protected]";  
		 keywordRequest.notifylistphone = "1234567891,1345678919";
          WSKeywordResponse wSKeywordResponse = WSKeywordResponse ManageKeyword(string securityToken, KeywordRequest Keyword);;
 if (!wSKeywordResponse.Result)
 {
     //handle error
          label.Text = wSKeywordResponse.Message;
 }
 else
 {
     //handle success
     label.Text = wSKeywordResponse.Message;
     }

 

SOAP

Soap Request 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://SBTService/ServiceContracts/" xmlns:ser1="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:dat="http://SBTAPIService/DataContract/">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:ManageKeyword>
         <!--Required:-->
         <ser:securityToken>Security Token</ser:securityToken>
            <ser:Keyword>
            <!--Required:-->
            <dat:groupCode>Group Org Code</dat:groupCode>
            <!--Required:-->
            <dat:Keyword>Keyword name</dat:Keyword>
            <!--Optional:-->
            <dat:note>Note</dat:note>
            <!--Required:-->
            <dat:response>Keyword Response Message</dat:response>
            <!--Required:-->
            <dat:isautosubscribe>1</dat:isautosubscribe>
            <!--Optional:-->
            <dat:keywordRequestType>0</dat:keywordRequestType>
            <!--Optional - But when 'isautosubscribe' field is '1', then this field is Required:-->
            <dat:subscribed_response>Already subscribed response message for keyword</dat:subscribed_response>
            <!--Optional:-->
            <dat:notifylistemail>Notification email id list with comma seperated</dat:notifylistemail>
            <!--Optional:-->
            <dat:notifylistphone>Notification mobile number list with comma seperated</dat:notifylistphone>
         </ser:Keyword>
      </ser:ManageKeyword>
   </soapenv:Body>
</soapenv:Envelope>
            

Soap Response      
  
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
     <s:Body>
        <ManageKeywordResponse xmlns="http://SBTService/ServiceContracts/">
           <ManageKeywordResult  z:Id="i1" xmlns:a="http://SBTAPIService/DataContract/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
              <a:ErrorCode>1489</a:ErrorCode>
              <a:message>Keyword  created  successfully</a:message>
			  <a:keyword>apikw1</a:keyword>
              <a:groupCode>groupCode</a:groupCode>
			  <a:communicationCode>communication code where keyword created</a:communicationCode>
              <a:result>true</a:result>
           </ManageKeywordResult>
        </ManageKeywordResponse>
     </s:Body>
  </s:Envelope>

 

REST

Method: POST

URL: https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/KeywordRSService.svc/ManageKeyword

Sample C# Code:

KeywordRequest keywordRequest = new KeywordRequest
            {
                groupCode = "",
                Keyword = "Keyword",
                note = "note",
                response = "response",
                isautosubscribe = "0",
                keywordRequestType = "0",
                subscribed_response ="subscribed_response",
                notifylistemail = "[email protected],[email protected]",
                notifylistphone = "1234567891,1567891011"
            };

            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(SubscriberDetails));
            MemoryStream mem = new MemoryStream();
            ser.WriteObject(mem, tempDetail);
            string data = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);

            var requestdata = new
            {
                securityToken = "securityToken",
                Keyword = keywordRequest
            };

            string data2 = JsonConvert.SerializeObject(requestdata).ToString();

            System.Net.WebClient webClient = new System.Net.WebClient();
            webClient.Headers["Content-type"] = "application/json";
            webClient.Encoding = Encoding.UTF8;
var strManageKeyword = webClient.UploadString("https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/KeyworsRSService.svc/ManageKeyword", "POST", data2);

Note:“ strManageKeyword” contains the output response as return values

 

Response:

The response will be in JSON format like below:

{" ManageKeywordResult": {
   "result": true,
   "error_code": 1514,
   "Message": " Keyword updated succesfully",
   "Keyword": " TST1345",
   "communicationcode": " 12456"
}}