title: How to receive the SMS via twilio
body: <p>I have <a href="https://www.twilio.com/docs/salesforce/install" rel="nofollow noreferrer">installed the twilio package</a> and following components. How do I configure the two components? When customer sends an sms it does not create a case in the sandbox. I am unable to receive sms details. What is the twilio message url where should I give in the salesforce?</p>
  
  <p><img src="https://i.stack.imgur.com/gckeS.png" alt="enter image description here"></p>
  
  <p>I am completely new to twilio configuration. Can someone please help.
  Whenever customer sends an sms, then it should create a case in the sandbox automatically by using twilio api .</p>
  
  <p><strong>Component 1: Visual force Fage</strong></p>
  
  <pre><code>&lt;apex:page controller="TwilioRequestControllerContacts" action="{!init}" showHeader="false" sidebar="false"&gt;
      &lt;center&gt;
          &lt;apex:pageBlock title="Twilio Request Listener"&gt;&lt;/apex:pageBlock&gt;          
      &lt;/center&gt;
  &lt;/apex:page&gt;
  </code></pre>
  
  <p><strong>Component 2: Controller</strong></p>
  
  <pre><code>public with sharing class TwilioRequestControllerContacts 
  {
      public String fromNumber      = ApexPages.currentPage().getParameters().get('From');
      public String toNumber        = ApexPages.currentPage().getParameters().get('To');
      public String body            = ApexPages.currentPage().getParameters().get('Body');
      public PageReference init()
      {
      try
      {           
         System.debug('STEP 0 FROM: ==========&gt;' + fromNumber);
         System.debug('STEP 1 TO: ===============&gt;' + toNumber);
         System.debug('STEP 2 BODY: ==========&gt;' + body);
         System.debug('STEP 3  ==============&gt;');                 
         String account = 'xxxxxxxxxxx';   
         String token = 'xxxxxxxxxxxx';
         TwilioRestClient client = new TwilioRestClient(account,token);
         system.debug('STEP 4 test==3&gt;'+client);
         if(fromNumber != null &amp;&amp; toNumber != null) {  
         //my own logic                
          Case ca = new Case(Subject = fromNumber,Description = body,Origin = 'Phone');
             INSERT ca;       
             RETURN null;
         }
      }                
     catch(exception e){
          system.debug('STEP 7 error ==========&gt;'+e);
     }
      RETURN null;
     }  
  }
  </code></pre>