Hello All ,
Sending Email in Siebel is very basic and very useful functionality ,which we widely use.
Command F9 is provided by default for sending the email via Pick recipient option.
so using existing framework lets try to extend this functionality for sending SMS,
Solution,
lets extend this functionality to send SMS too ,
by default there is Option to Pick Recipient which in turn selects email address as it is Based on Contact ,
so we need to add some custom code here to Pick Phone number also for the contact
also we need to enter the Text which we want to sens as SMS Body , and store it in a variable
Below code in Applet PreInvoke does the needful,
function WebApplet_PreInvokeMethod (MethodName)
{
if(MethodName == "SendSMS")
{
this.BusComp().ActivateField("Contact Id");
this.BusComp().ActivateField("Email Body");
var SMSBody = this.BusComp().GetFieldValue("Email Body"); // get SMS body to be sent
var PhoneNum = this.BusComp().GetMVGBusComp("Contact Id").GetFieldValue("Cellular Phone #"); //get Phone number to send SMS
sendSMS(SMSBody,PhoneNum);
}
Now we can send SMS as we have Phone number and Message Body,
There are certain API available for this, i am using way2sms for this purpose,
API for way2sms :
apikey, unique key for user
secret, unique key for user
usetype, stage or Production
phone, Number to send SMS to
message, Message body
sample Request : http://www.way2sms.com/api/v1/sendCampaign?apikey=UO9EWGKEQI2YQA5BSCRJHT5TUXHORPP8&secret=UX93MQ92VIBTCGY7&usetype=stage&phone=999670002&message=HelloRahul");
Paramteterized Request : PhoneNumber and Message passed in Request as variable
http://www.way2sms.com/api/v1/sendCampaign?apikey=UO9EWGKEQI2YQA5BSCRJHT5TUXHORPP8&secret=UX93MQ92VIBTCGY7&usetype=stage&phone="+ PhoneNum +"&message"+ SMSBody;
now we can call Siebel EAI Transport to Hit the URL ,
Note:
1. ALT + F9 is default command to Open Send Wireless Message applet
2. SMS API depends on the client, as i have chosen free demo from way2sms, working with different API ,might require different code
3. By Default there is Option of Pick Recipient which Open a Pick applet for choosing recipient first, before navigating to Send SMS Applet, this is default behavior and can be overridden with below steps (will share detailed solution in later post)
Sending Email in Siebel is very basic and very useful functionality ,which we widely use.
Command F9 is provided by default for sending the email via Pick recipient option.
so using existing framework lets try to extend this functionality for sending SMS,
Solution,
- There is default option for Send Wireless Message in Siebel which is Invoked from Command ALT + F9
lets extend this functionality to send SMS too ,
- Find the target Applet , "Send SMS Applet"
by default there is Option to Pick Recipient which in turn selects email address as it is Based on Contact ,
so we need to add some custom code here to Pick Phone number also for the contact
also we need to enter the Text which we want to sens as SMS Body , and store it in a variable
Below code in Applet PreInvoke does the needful,
function WebApplet_PreInvokeMethod (MethodName)
{
if(MethodName == "SendSMS")
{
this.BusComp().ActivateField("Contact Id");
this.BusComp().ActivateField("Email Body");
var SMSBody = this.BusComp().GetFieldValue("Email Body"); // get SMS body to be sent
var PhoneNum = this.BusComp().GetMVGBusComp("Contact Id").GetFieldValue("Cellular Phone #"); //get Phone number to send SMS
sendSMS(SMSBody,PhoneNum);
}
- Add Button to Invoke method say SendSMS , that will trigger SMS.
Now we can send SMS as we have Phone number and Message Body,
There are certain API available for this, i am using way2sms for this purpose,
API for way2sms :
apikey, unique key for user
secret, unique key for user
usetype, stage or Production
phone, Number to send SMS to
message, Message body
sample Request : http://www.way2sms.com/api/v1/sendCampaign?apikey=UO9EWGKEQI2YQA5BSCRJHT5TUXHORPP8&secret=UX93MQ92VIBTCGY7&usetype=stage&phone=999670002&message=HelloRahul");
Paramteterized Request : PhoneNumber and Message passed in Request as variable
http://www.way2sms.com/api/v1/sendCampaign?apikey=UO9EWGKEQI2YQA5BSCRJHT5TUXHORPP8&secret=UX93MQ92VIBTCGY7&usetype=stage&phone="+ PhoneNum +"&message"+ SMSBody;
now we can call Siebel EAI Transport to Hit the URL ,
sendSMS(SMSBody,PhoneNum) ///SMS////// var k = "https://smsapi.engineeringtgr.com/send/?Mobile=***67753*2&Password=able&Message="+SMSBody+"&To="+PhoneNum+"&Key=RAHULVsG7AhXF0bnm2uz"; var EAISiebelAdapter = TheApplication().GetService("EAI HTTP Transport"); var Inputs = TheApplication().NewPropertySet(); var Outputs = TheApplication().NewPropertySet(); Inputs.SetProperty("HTTPRequestURLTemplate","https://smsapi.engineeringtgr.com"); Inputs.SetProperty("HTTPRequestBodyTemplate",k); Inputs.SetProperty("HTTPRequestMethod","POST"); //Inputs.SetProperty("HTTPContentType", "text/xml; charset=UTF-8"); EAISiebelAdapter.InvokeMethod("Send", Inputs , Outputs); ////sms end////TheApplication().RaiseErrorText( "SMS "+ SMSBody +" sent to user with Phone Number "+ PhoneNum);*/return (CancelOperation); } return (ContinueOperation);} |
Note:
1. ALT + F9 is default command to Open Send Wireless Message applet
2. SMS API depends on the client, as i have chosen free demo from way2sms, working with different API ,might require different code
3. By Default there is Option of Pick Recipient which Open a Pick applet for choosing recipient first, before navigating to Send SMS Applet, this is default behavior and can be overridden with below steps (will share detailed solution in later post)
- Open The User Property for the BC
- Search for Enable Recipient in User Property
- Disable and Compile/Deliver