I have twilio phone number,Visual force page and Controller.I have reference Document I have followed.I send an sms via twilio but unable to receive the sms. Customer Send an sms to twilio number it can revert back the sms but unable to receive the sms details in Salesforce Apex
Visual force page
<apex:page controller="TwilioRequestControllerContacts" action="{!init}" showHeader="false" sidebar="false">
<center>
<apex:pageBlock title="Twilio Request Listener"></apex:pageBlock>
</center>
</apex:page>
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);
IF(fromNumber != NULL && toNumber = !NULL){
Case c = new Case(Subject = toNumber+fromNumber,Description =body);
insert c;
}
}
catch(exception e){}
RETURN null;
}
}
Here SMS conformation sent dynamically while customer send an sms it is ok. But unable to receive the SMS details. I am doing correct way or not can some one please help me
Finally I have created a Case while Customer Sent an SMS twilio Phone number.
Steps:
Path :Setup > Developer > "New"
Note : The Site Url and Twilio Account SMS Url must and should be same other wise the HTTP post request will not post to your Visualforce page.
Path :Setup > Administer > Security Controls > Remote Site Settings > "New Remote Site"
Then send an SMS to your Twilio phone number. It will create a new case in the Sandbox. It is amazing concept of Twilio API for the Salesforce.