twilio-f | Twilio microservice to forward Calls and SMS | SMS library
kandi X-RAY | twilio-f Summary
kandi X-RAY | twilio-f Summary
Twilio microservice to forward Calls and SMS
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of twilio-f
twilio-f Key Features
twilio-f Examples and Code Snippets
Community Discussions
Trending Discussions on twilio-f
QUESTION
We are using Twilio CLIENT to make voice calls from browser to phone numbers.
On the Twilio server side we build a getToken function, based in this article: https://www.twilio.com/blog/generate-access-token-twilio-chat-video-voice-using-twilio-functions
On the client side, do you think sending ’identity’, ‘secretKey’, ‘accountSid’ without encription is correct, in terms of security?
Is this the recommended way to do this?
Here is the function 'getToken':
...ANSWER
Answered 2021-May-03 at 01:33Twilio developer evangelist here.
I do not recommend that you expose your secretKey in the client-side at all.
If you are looking to limit access to this endpoint, then I would start by restricting the origins from which you can access it. Right now you are allowing requests from all origins, with the *
operator.
QUESTION
I want to know the lifetime of temporary storage in Twilio Functions. To be specific, I have the following two questions:
For a studio flow, are all run-function-widgets access the same temporary storage? e.g. using it as a cache so I can download data from an external link once only (for each incoming phone call)
For different incoming phone calls, are temporary storage shared (or possibly shared) between them? I want to store some temporary user-specific data in it. I want to ensure that they can not see each other's temporary storage for different incoming phone calls.
Here is a similar question, but I don't think "the answer" answered the question.
I have read this blog and it says "For example, you might like to create a file with user-provided data and send it onto the next step in a flow based on your business needs". I guess it means for different incoming phone calls, executions of flow have their own temporary storage, but I am not sure.
...ANSWER
Answered 2021-Apr-26 at 11:38Answers:
Temporary Storage is only available for the Twilio Function that created the temporary storage at the time that Function is invoked and running. Once the Function is done running, the temporary storage is no longer available.
See #1, you will need to store state outside Studio and Functions if you want data to persist data across Studio flows/Function invocations. Some example of doing this are using Twilio Sync or Airtable to persist data.
The Joints Of The Contact Center: Twilio’s Sync API
Use Twilio Sync to create, read, update, delete persist data
QUESTION
I am using Twilio Flex to support a call center. I have a TaskRouter workflow set up where Task Reservation Timeout is set to 120 seconds. In its filter, I've created two routing steps. The first one finds matching workers in the main queue and has a timeout of 120 seconds. After 120 seconds, it should move to Call Forward Queue. In the call forward queue, no workers exist (target worker expression: 1==2). I'm catching all these events with a "trEventListener" function. Once a task is moved into the Call Forward queue, I call the "callForward" function which uses twiml.dial() to connect the call to an external number. I also change this task's status to "canceled" with a custom reason so I can track it in flex insights. I am using the guide in this link to form my logic: https://support.twilio.com/hc/en-us/articles/360021082934-Implementing-Voicemail-with-Twilio-Flex-TaskRouter-and-WFO.
Call forwarding is working fine but according to Flex insights, there are some calls that get handled after 120 seconds (between 120 - 300 seconds). Ideally, these should be forwarded as well. There is also no error logged for me to track down why this is happening to only a handful of calls.
Furthermore, in some cases, when I try to change the task status to cancel with my custom reason, it spits out the following error: Cannot cancel task because it is not pending or reserved. In other cases, it works fine. It's again hard to figure out why it's selectively working and not consistent in its behavior.
Here is the function code.
trEventListener.js:
...ANSWER
Answered 2021-Mar-31 at 07:48Twilio developer evangelist here.
When you redirect a call from a task, its task is cancelled with the reason "redirected" so you don't need to cancel it yourself.
Your code was failing to update the task occasionally because of a race condition between your code and the task getting cancelled by Twilio.
QUESTION
I used twilio serverless:init
to generate a Twilio service locally and then later deployed it to Twilio. At some point I noticed a file named .twilio-functions
present in the root of the project. It's contents looked like this:
ANSWER
Answered 2021-Mar-20 at 01:40.twilio-functions
is created when you call twilio serverless:deploy
. It basically just keeps a log of the latest build and service SIDs.
You can delete it if you want, since I don't think it's used anywhere. But I would just leave it, since it doesn't hurt and it will keep reappearing every time you deploy.
You don't need to store it in version control, since it's an output of the deploy process, like a log. It might already be ignored in the auto-generated .gitignore
file. If it's not there, you can add it as was done in these GitHub repos.
If you want to know where this config file is created:
- The create-twilio-function CLI tool targets the deploy script in create-files.js
- deploy.ts is implemented in twilio serverless-toolkit
- deploy.ts calls the method saveLatestDeploymentData, which creates the config data structure
QUESTION
I followed this guide to setup this service:
I have this all set up and working but what confused me is, when someone sends a message to the Twilio number. It will send the message to all the users in the google sheets but when the users receive the messages, it doesn't show who sent the message. It says From: (The persons name who the message was sent to rather than where it was sent from.
For example: Person A send a message to Twilio Number
Person B receives the message as follows:
From: Person B
(should have person A's info there)
Any help from the developer of this would be helpful.
...ANSWER
Answered 2021-Feb-13 at 18:28I'm not the developer but in the handler
where you call twiml.message
change:
QUESTION
I'm facing a "runtime application timed out"
error whenever I try to filter TaskQueues. Here is the complete scenario.
On the twilio flex contact pad, I have to show cumulative count of pending tasks from all the task queues, that the agent belongs to. For this, I have written a twilio function which takes the worker skills as input and filters TaskQueues based on skills supplied, and count the pending tasks. I followed the twilio documentation provided here. I tried different ways to write the expression, but all are eventually resulting in time out error.
The worker attributes are defined as below
...ANSWER
Answered 2021-Feb-11 at 21:53Twilio developer evangelist here.
It looks like your function is written mostly correctly and should return. There's two things I can think of that might be going wrong.
It really is timing outI'm not sure how many queues you have, but getting all the queues and then getting all the statistics for each queue could just be pushing your Function over the 10 second limit for Function execution. If that is the case, then may have to break up the Function so that it can run within the time. Are you able to run this locally (using the Twilio Serverless Toolkit) and it succeed?
There's an error that is not being caught and the promises don't resolveYour code looks right to me, but the way you wrap the results of API calls in a new promise means that if there is an error the wrapper promise never resolves or rejects. This would mean that the Function hangs waiting for a result until the timeout occurs.
Thing is, you don't need to wrap the API calls in a new Promise, they already return Promises.
I would try rewriting it like this, avoiding new Promise wrappers and then seeing if there is an error that you aren't catching. You can also avoid pushing promises into an array and jump straight into the Promise.all
too:
QUESTION
I'm attempting to use Twilio Functions to handle token generation for my Twilio application. I previously was using a Node.js + Express Server to accomplish this, but I do not know how to figure out enable CORS in this type of environment.
My Client Code looks like this:
ANSWER
Answered 2017-Aug-11 at 07:53This client code ended up working:
QUESTION
I would like to pass along the Twilio phone number's Friendly Name when I forward the SMS message to another phone number. (The Friendly Name is a property assigned to a Twilio number when it is purchased.)
This is not the same as "Send Branded SMS Messages Using Twilio Alphanumeric Sender ID" described here and here.
I am operating in the USA where the above is not supported, and I am OK including the "Friendly Name" in the body of the forwarded message (or the subject line of the email). Also, The "Friendly Name" is not associated with the original sender of the message as in the above examples, but instead is associated with my Twilio numbers. Hope that's all clear.
I am using this example code:
Forwarding SMS messages to another phone number – Twilio Support
Three parameters are passed into the function:
...ANSWER
Answered 2019-Nov-11 at 01:08You are well on the right path! Excellent research. In fact, context.getTwilioClient() is part of it. Once you have the Twilio REST API client initialized, you can use another Twilio API to determine what the FriendlyName is from the event.To. I found that here, Filter IncomingPhoneNumbers with exact match.
Below is one way, there certainly may may be others.
QUESTION
I want to write a plugin for WordPress which says 'Hello World' for incoming calls to my Twillio phone-number.
I set a POST webhook for incoming calls on Twilio admin: https://myWPsite.com/wp-json/callcenter/incoming
.
I created a WP-plugin with the following code (found in Twilio Docs), and placed the Twilio PHP helper lib into it's folder:
ANSWER
Answered 2019-Jul-07 at 08:54To solve this error, I changed use Twilio\TwiML;
to use Twilio\Twiml;
, although I read that Twiml
is depracted, but I could not make it work another way.
After this I still get Invalid Content-Type
error, and I see in the debugger that the content type is:Content-Type application/json; charset=UTF-8
.
So I added the following line to my function: header('content-type: text/xml');
.
Now I get an Document parse failure
error, and my response body looks the following:
QUESTION
I'm new to Twilio. I'm attempting to forward an SMS to an email address using this tutorial:
I feel certain I've done everything it says to do, but I get an error 11200 HTTP retrieval failure every time, with these details:
{ "message": "Cannot find module 'got'", "name": "Error", "stack": "Error: Cannot find module 'got'\n at Function.Module._resolveFilename (module.js:547:15)\n at Function.Module._load (module.js:474:25)\n at Module.require (module.js:596:17)\n at Module.twilioRequire [as require] (/var/task/node_modules/enigma-lambda/src/dependency.js:28:21)\n at require (internal/module.js:11:18)\n at Object. (/var/task/handlers/ZFa37cc3db9fd8db0501c2e5fc92137969.js:1:75)\n
at Module._compile (module.js:652:30)\n at Object.Module._extensions..js (module.js:663:10)\n at Module.load (module.js:565:32)\n at tryModuleLoad (module.js:505:12)" }
I've tried making absolutely sure I have the function written the same as the tutorial. I copied it directly from the github page to be sure. I'm not sure how to proceed in troubleshooting this, it seems it's telling me that 'got' isn't found but it's supposed to be available in Twilio functions. Any ideas? Thanks.
Edit: Here is the code:
...ANSWER
Answered 2018-Jun-06 at 19:50First, the above code with got
works with my Twilio and SendGrid accounts, I just tested, I don't know why you're having trouble..., maybe try to create a Twilio subaccount and run from there.
Second, if you still can't get got
to work, here is some code, you could try,
and I'we also tested and it works. It's using https
instead:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install twilio-f
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page