function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
raju p 4raju p 4 

callout end pointe url

public class sendsmsTwilio {
public string Messages{set;get;}
public string ACCOUNTSID{set;get;}  
public string AUTHTOKEN{set;get;}
  public string Mobile{set;get;}
public string result{set;get;}
public contact con;

public sendsmsTwilio(ApexPages.StandardController controller) {
con =(contact)controller.getrecord();
}
public void sendsmsTwilio(){
BoxIntrgration__c c= [SELECT  accountsid__c, AUTHTOKEN__c from BoxIntrgration__c where name=:'twilio'];
ACCOUNTSID=c.accountSid__c;
AUTHTOKEN=c.AUTHTOKEN__c;

Http p= new http();
HttpRequest req= new HttpRequest();
 string url='https://api.twilio.com/2010-04-01/Accounts/AC58cf47802fa54fe399e85fd822bf2103/Messages.json';
   string body ='Well come';
          body=body+'&To=+con.phone';
           body=body+'&AUTHTOKEN';
            body=body+'&MessagingServiceSid=MG3d0796691bb5c2d7ed266c1850240962';               

req.setmethod('POST');
httpresponse res= new httpResponse();
  // try{
res=p.send(req);
//}
//catch(Exception e){
//system.debug(e);
//}
result=res.getbody();

>>>>>>>>>>>>>>>>>
<apex:page standardController="contact" extensions="sendsmsTwilio">
<apex:form >
<apex:pageblock >
<apex:inputtext value="{!contact.phone}"/>

<apeX:pageblockButtons >
<apex:commandButton value="SendSms" action="{!sendsmsTwilio}"/>
</apeX:pageblockButtons>
</apex:pageblock>
</apex:form>
{!result}
  
</apex:page>
 i am getting  callout null endpoint url at line 28,
 i am trying to send sms . i use try cath but i am not able recive the sms




}
       
}
Amit Chaudhary 8Amit Chaudhary 8
Try to update your code like below
public class sendsmsTwilio {
public string Messages{set;get;}
public string ACCOUNTSID{set;get;}  
public string AUTHTOKEN{set;get;}
public string Mobile{set;get;}
public string result{set;get;}
public contact con;

	public sendsmsTwilio(ApexPages.StandardController controller) {
		con =(contact)controller.getrecord();
	}
	
	public void sendsmsTwilio()
	{
	
		BoxIntrgration__c c= [SELECT  accountsid__c, AUTHTOKEN__c from BoxIntrgration__c where name=:'twilio'];
		ACCOUNTSID=c.accountSid__c;
		AUTHTOKEN=c.AUTHTOKEN__c;

		Http p= new http();
		HttpRequest req= new HttpRequest();
		string url='https://api.twilio.com/2010-04-01/Accounts/AC58cf47802fa54fe399e85fd822bf2103/Messages.json';
		string body ='Well come';
				  body=body+'&To=+con.phone';
				   body=body+'&AUTHTOKEN';
					body=body+'&MessagingServiceSid=MG3d0796691bb5c2d7ed266c1850240962';               

		req.setEndpoint(url);
		req.setBody(body);
		req.setmethod('POST');
		httpresponse res= new httpResponse();
		res=p.send(req);
		result=res.getbody();


	}
       
}