连接Twilio与Google Apps脚本 [英] Connect Twilio wtih Google Apps Script

查看:84
本文介绍了连接Twilio与Google Apps脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循GAS团队的这个教程。
使用Twilio和Apps脚本将语音和短信添加到Google Apps
但是,当我根据Twilio文档修改 TwiML 以添加< Redirect> 超时后,我得到一个应用程序错误。

 < Response> 
< Gather action =https://script.google.com/macros/s/SCRIPT_ID/execnumDigits =1timeout =10>
< Say>欢迎来到Yard Stars< / Say>
< Say>要预定喷水灭火服务访问,请按1.< / Say>
< Say>要讨论新的喷淋头系统,请按2.< / Say>
< Say>与会计中的某人说话,请按3.< / Say>
< / Gather>
< Say>对不起,我没有收到您的回覆。< /说>
<重定向方法=GET> https://script.google.com/macros/s/SCRIPT_ID/exec< /重定向>
< / Response>

我注意到的一件事是GAS正在发送Twilio没有的Transfer-Encoding Chunked支持。
然而,它似乎只影响重定向呼叫。

任何想法的解决方法如何我可以重定向调用一个Apps脚本?

我回答了我自己....问题原来是Twilio不支持chunked请求。这个错误是由Twilio截断了我的请求引起的(因此我认为XML由于缺少结束标签而认为是无效的),我通过他们的支持页面联系了Twilio支持,他们能够给我一个解决方法(他们指出我的应用程序到不同的代理服务器)。

I followed this tutorial from the GAS team. Adding voice and SMS to Google Apps using Twilio and Apps Script However, when I modify the TwiML as per the Twilio Docs to add <Redirect> upon timeout, I get an "Application Error".

<Response>
   <Gather action="https://script.google.com/macros/s/SCRIPT_ID/exec" numDigits="1" timeout="10">
     <Say>Welcome to Yard Stars</Say>
     <Say>To schedule a Sprinkler Service visit, press 1.</Say>
     <Say>To discuss a new Sprinkler System, press 2.</Say>
     <Say>To speak with someone in accounting, press 3.</Say>
   </Gather>
   <Say>Sorry, I didn't get your response.</Say>
   <Redirect method="GET">https://script.google.com/macros/s/SCRIPT_ID/exec</Redirect>
</Response>

One thing that I noticed is that GAS is sending back "Transfer-Encoding Chunked" which Twilio does not support. However it appears to only effect the Redirect Call.
Any idea of a workaround how I can make a Redirect call to an Apps Script?

解决方案

I answered myself....The issue with this turned out to be that Twilio does not support "chunked" Requests. The error was being caused by Twilio truncating my Request (and thus thinking the XML was not valid due to the perception of missing End Tags) I contacted Twilio support via their support pages and they were able to give me a workaround (they pointed my application to a different proxy server).

这篇关于连接Twilio与Google Apps脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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