我有installed the twilio package及以下组件。如何配置这两个组件?当客户发送短信时,它不会在沙箱中创建案例。我无法收到短信详情。什么是twilio消息URL我应该在salesforce中给出什么?
我对twilio配置完全陌生。有人可以请帮助。 每当客户发送短信时,它应该使用twilio api自动在沙箱中创建一个案例。
组件1:视觉力量法
<apex:page controller="TwilioRequestControllerContacts" action="{!init}" showHeader="false" sidebar="false">
<center>
<apex:pageBlock title="Twilio Request Listener"></apex:pageBlock>
</center>
</apex:page>
组件2:控制器
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;
}
}
答案 0 :(得分:-1)
转到这篇文章,这肯定会帮助你
http://abhithetechknight.blogspot.in/2014/06/salesforce-integration-with-twilio.html
此致 Abhi Tripathi SFDC认证开发人员