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
Ramesh SomalagariRamesh Somalagari 

How to receive the SMS via twilio

I have install the twilio package and following components.How to configure the two components.When customer send an sms it not created an case in sandbox.Here I am unable to receive sms details.The twilio message url where should I give in the salesforce.

User-added image
I am completely new about twilio configuration.Can someone please help.
Whenever customer send an sms then it create an case in sandbox automatically by using twilio api .

**Component 1: Visual force Fage**

    <apex:page controller="TwilioRequestControllerContacts" action="{!init}" showHeader="false" sidebar="false">
        <center>
            <apex:pageBlock title="Twilio Request Listener"></apex:pageBlock>         
        </center>
    </apex:page>
**Component 2: Controller**

    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: ==========>' + fromNumber);
           System.debug('STEP 1 TO: ===============>' + toNumber);
           System.debug('STEP 2 BODY: ==========>' + body);
           System.debug('STEP 3  ==============>');                
           String account = 'xxxxxxxxxxx';  
           String token = 'xxxxxxxxxxxx';
           TwilioRestClient client = new TwilioRestClient(account,token);
           system.debug('STEP 4 test==3>'+client);
           if(fromNumber != null && 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 ==========>'+e);
       }
        RETURN null;
       } 
    }



Dhilip DussaDhilip Dussa
Hi,

I need to return this values in lightning component how it is possible pease help me

Thanks