无法通过 twilio 接收短信 [英] Unable to Receive the SMS via twilio

查看:188
本文介绍了无法通过 twilio 接收短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 twilio 电话号码、视觉力页面和控制器.我有参考 文档 我已关注.我通过 twilio 发送了短信,但无法接收短信.客户向 twilio 号码发送短信,它可以恢复短信,但无法在 Salesforce Apex

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

视觉强制页面

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

控制器

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

推荐答案

最后我创建了一个案例,而客户发送了一个 SMS twilio 电话号码.

Finally I have created a Case while Customer Sent an SMS twilio Phone number.

步骤:

  • 在 Sandbox 中安装 Twilio 后,我们需要创建一个 Visualforce 页面和一个指定的控制器.
  • 创建一个 Force.com 站点并将您的 Visualforce 页面添加到您的站点.然后给站点 url(https://sandbox.force.com/sms).

路径:设置 > 开发人员 > 新建"

Path :Setup > Developer > "New"

注意:站点 URL 和 Twilio 帐户 SMS Url 必须并且应该相同,否则 HTTP 发布请求将不会发布到您的 Visualforce 页面.

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.

  • 授予站点访问控制器和案例对象的权限.从站点详细信息页面,单击公共访问设置以访问站点的访客用户配置文件.启用对案例对象的读取和编辑访问权限.将控制器 Apex 类添加到已启用的 Apex 类访问列表.
  • 在 Sandbox 中创建远程站点设置,即 Twilio API 的端点 URL.

路径:设置>管理>安全控制>远程站点设置>新建远程站点"

Path :Setup > Administer > Security Controls > Remote Site Settings > "New Remote Site"

然后向您的 Twilio 电话号码发送短信.它将在沙箱中创建一个新案例.这是用于 Salesforce 的 Twilio API 的惊人概念.

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.

这篇关于无法通过 twilio 接收短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆