如何最好地手动回复来自 Twilio 电话号码的文本? [英] How can I best manually reply to texts from a Twilio phone number?

查看:33
本文介绍了如何最好地手动回复来自 Twilio 电话号码的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对其他电话提供商有点受够了,希望拥有一个更加可编程、可配置的个人电话号码(我想念 GrandCentral).谷歌语音很好,但我想建立更好的东西.Twilio 很棒!我正在考虑将我的个人电话号码移植到 Twilio.

I'm a bit fed up with other phone providers and would like to have a more programmable, configurable, personal phone number (I miss GrandCentral). Google Voice is good, but I want to build something better. Twilio is great! I'm considering porting my personal phone number to Twilio.

我已经找到了 TwiML 的电话路由,但我遇到的问题是短信.我不能只将文本消息转发到我的刻录机手机/智能手机,因为要使回复自然,我需要能够回复并将其路由回发件人.Google 语音通过从唯一号码转发每个传入的转发文本来处理此问题,以便回复发送到正确的位置,但我认为使用 Twilio 会很快变得昂贵.

I already have phone routing TwiML figured out, but where I'm stuck is text messaging. I can't just forward text messages to my burner phone/smart phone, because for replies to be natural, I need to be able to reply and have it get routed back to the sender. Google Voice handles this by forwarding every incoming forwarded text from a unique number so replies go to the right place, but I think this would get expensive quick with Twilio.

是否有某个地方的某个人(可能是 Twilio 自己)已经构建了一个简单的应用程序或网关,可以让我回复到 Twilio 电话号码的文本?它可以是网络应用、移动应用、WhatsApp 网关等等.

Is there a simple app or gateway that someone somewhere has already built (Twilio themselves perhaps) that lets me reply to texts to a Twilio phone number? It could be a web app, mobile app, WhatsApp gateway, whatever.

我研究了 Twilio Programmable SMS/Chat,它看起来绝对是正确的构建块,但似乎也解决了这个问题.我将构建一个网络/移动应用程序和一个后端服务来管理我的文本.对 Twilio 数字的手动文本响应肯定已经存在.

I looked into Twilio Programmable SMS/Chat, which definitely seems like the right building blocks, but also seems like to solve this I'd be building a web/mobile app and a backend service to manage my texts. Surely something already exists for manual text response to Twilio numbers.

我研究了 Twilio Flex(和其他客户管理/代理中心解决方案),它可以工作!但这似乎有点矫枉过正,我找不到在我的智能手机上进行 Twilio Flex 代理响应(例如,回复我的家人)的方法.是否有 Twilio Flex 移动应用程序?有什么不那么矫枉过正的吗?我确信我会在 Twilio 仪表板中找到一些可以让我手动回复文本的内容.

I looked into Twilio Flex (and other customer management/agent center solutions) and that could work! But it seems overkill and I couldn't find a way to do Twilio Flex agent responses (e.g., reply to my family) on my smart phone. Is there a Twilio Flex mobile app? Is there something less overkill? I thought for sure I'd find something in the Twilio dashboard that would let me manually reply to texts.

只是寻找最基本的短信/彩信收件箱,我可以找到 Twilio 电话号码的回复功能,而无需构建太多.谢谢!

Just looking for the most basic SMS/MMS inbox with reply functionality for a Twilio phone number I can find without having to build too much. Thanks!

推荐答案

免费使用号码的一种简单方法(除了 Twilio 的费用)是使用附有脚本的 Google 电子表格.

An easy way to use your number for free (besides Twilio's costs) is to use a Google Spreadsheet with a script attached.

这是一个基本模板,您可以从中开始并进行相应调整.

Here is a basic template you could start from and adjust accordingly.

步骤 1. 创建新的 Google 电子表格.

STEP 1. Create New Google Spreadsheet.

步骤 2. 标记列 A-E 日期、发件人、传入消息、回复、状态.

STEP 2. Label columns A-E Date, From, Incoming Message, Reply, Status.

STEP 3. 打开脚本编辑器并清除内容并粘贴下面的代码.

STEP 3. Open script editor and clear contents and paste code below.

步骤 4. 通过插入您的 TWILIO_ACCOUNT_SID、TWILIO_AUTH_TOKEN(可在您的 Twilio 仪表板中找到)TWILIO 电话号码来编辑脚本.

STEP 4. Edit script by inserting your TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, (can be found in your Twilio dashboard) TWILIO PHONE NUMBER.

步骤 5. 将您的脚本部署为 Web 应用程序 确保设置谁有权访问应用程序"对任何人,甚至匿名"(Twilio 仅适用于公共 URL).

STEP 5. Deploy your script as a web app MAKE SURE to set the "who has access to the app" to "anyone, even anonymous" (Twilio will only work with public URLs).

第 6 步:部署后复制 google 提供的网络应用 URL.

STEP 6. After deployed copy the web app URL supplied by google.

步骤 7. 转到您的 Twilio 电话号码并将 URL 粘贴为消息传入时的 Webhook,确保将其更改为 HTTP GET.

STEP 7. Go to your Twilio phone numbers and paste the URL as the webhook for when a message comes in, MAKE SURE you change it to HTTP GET.

注意:确保通过从脚本编辑器运行该函数来授权脚本.

NOTE: make sure to authorize the script, by running the function from script editor.

function doGet(e) {
  var body = e.parameter.Body;
  var from = e.parameter.From;
  var time = new Date();
  
  var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet()
  ss.appendRow([time,from,body]);
}

    function onOpen() {
      var ui = SpreadsheetApp.getUi();
      ui.createMenu('Reply')
          .addItem('Send Reply', 'sendText').addToUi();
    }
    
    function sendText(){
      var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
      var range = ss.getActiveRange();
      var message = range.getValue();
      var getNumber = ss.getRange(range.getRow(), 2).getValue();
      var number = '+' + getNumber;
      var messagesUrl = "https://api.twilio.com/2010-04-01/Accounts/PASTE_YOUR_TWILIO_ACCOUNT_SID_HERE/Messages.json";
        
      var payload = {
        "To": number,
        "From" : "PASTE_YOUR_TWILIO_PHONE_NUMBER_HERE", //make sure its formated as +15556667777
        "Body" : message,
      };
      
      var options = {
        "method" : "post",
        "payload" : payload
      };
      
      options.headers = {    
        "Authorization" : "Basic " + Utilities.base64Encode("PASTE_YOUR_TWILIO_ACCOUNT_SID_HERE:PASTE_YOUR_TWILIO_AUTH_TOKEN_HERE")
      };
      UrlFetchApp.fetch(messagesUrl, options);
      return ss.getRange(range.getRow(), 5).setValue('Sent');
    }

要使用它,请在要回复的行中输入回复以确保选中该行中的任何单元格,然后转到回复"标签并点击发送文本"

To use it type a reply in the row you want to respond to make sure any cell in that row is selected, then go to the "Reply" tab and click "send text"

这篇关于如何最好地手动回复来自 Twilio 电话号码的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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