如何通过 twilio 接收短信

编程入门 行业动态 更新时间:2024-10-23 07:38:12
本文介绍了如何通过 twilio 接收短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我已经

问候,阿比·特里帕蒂SFDC 认证开发人员

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?

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 .

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;
   }  
}

解决方案

Go for this post, this will surely help you

http://abhithetechknight.blogspot.in/2014/06/salesforce-integration-with-twilio.html

Regards, Abhi Tripathi SFDC Certified Developer

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

更多推荐

[db:关键词]

本文发布于:2023-04-18 17:23:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/943661.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:短信   twilio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!