• Katleen Sulpice 18
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi
I am trying to SMS Gateway Integration. I am struck at a point. 
I am invoking the class with Javascript button. So when the button is clicked, the sms is sent. But i am an errors. Please help.

My javaScript button code
{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")}


var callout = "" + sforce.apex.execute("DisplaySMSQueueListViewRecords","SedingSMSManullay",
    {msg:"{!Customer__c.Vehicle__c}",phone:"{!Customer__c.Phone__c}"}); 
    
    alert("SMS Sent");

My Apex Class
 
Global class DisplaySMSQueueListViewRecords 
{
    //variables
     @future(Callout=true)
    //Sending SMS Manually
    Webservice static void SedingSMSManullay(String msg,String phone)
    {               
    
                     String mobileNumber=phone;
                      String SendSMSString = msg;     
                        Http h = new Http();
                        HttpRequest req = new HttpRequest();
                        req.setEndpoint('http://bhashsms.in/api/sendmsg.php?user=xxx&pass=123456&sender=xxx&phone='+mobileNumber+'&text='+SendSMSString+'&priority=sdnd&stype=normal');        								
                        req.setHeader('Accept', 'text/xml');
                        req.setHeader('Content-Type' , 'text/plain');
                        req.setMethod('GET');
 						HttpResponse res;
        				if(!Test.isRunningTest())
                        	res = h.send(req);
        				
                       // Responsebody =res.getBody();
                        System.debug('***********'+res);
     }      
 }

Error I am getting when i click the button or execute the class from dev console.
 
00:11:22:020 FATAL_ERROR System.CalloutException: Unauthorized endpoint, please check Setup->Security->Remote site settings. endpoint = http://bhashsms.in/api/sendmsg.php?user=xxx&pass=xxx&sender=xxx&phone=900000003&text=Message&priority=sdnd&stype=normal
I tried adding the Endpoint URL in the Remote Site Setting as "http://bhashsms.com" but it is still throwing the same error. 

Please help