如何通过twilio接收短信 [英] How to receive the SMS via twilio
问题描述
我已经安装了twilio软件包和以下组件.如何配置这两个组件?客户发送短信时,不会在沙箱中创建案例.我无法收到短信详细信息.我应该在Salesforce中输入什么twilio消息网址?
I have installed the twilio package 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?
我对twilio配置完全陌生.有人可以帮忙吗? 每当客户发送短信时,都应使用twilio api在沙箱中自动创建案例.
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 .
组成部分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;
}
}
推荐答案
转到该职位,这一定会对您有所帮助
Go for this post, this will surely help you
http://abhithetechknight.blogspot.in/2014/06/salesforce-integration-with-twilio.html
关于, 阿比·特里帕蒂(Abhi Tripathi) SFDC认证开发人员
Regards, Abhi Tripathi SFDC Certified Developer
这篇关于如何通过twilio接收短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!