1

I am using a Twilio Function which has an array of phone numbers.

I would like to be able to store these phone numbers in a 3rd party cloud database which we can edit with our CRM.

Then I'd write another Twilio function that will check the database and update the array in Twilio Functions with the latest data.

Alternatively if there is any other way that the first Twilio function could get the latest data from the database and store it in memory that would be great. I'd like to avoid checking the database for every request if possible in order to make the function as fast as possible.

Any help greatly appreciated!

Marcus
  • 675
  • 2
  • 8
  • 24

1 Answers1

1

Twilio developer evangelist here.

Currently, as Functions is in public beta, there is no API for Functions. So you cannot update Functions on Environment Variables for functions yet.

Also, due to beta limitations, you are unable to install Node modules, such as database drivers, so accessing remote data stores is currently not straightforward.

You can, from within a Function, make HTTP requests though. So, if your CRM could return a list of numbers in response to an HTTP request, then you could fetch them that way.

In terms of storing data in memory for Functions, this is not to be relied upon. Functions are short lived processes so the memory is volatile.

In your case, since you use a list of numbers, you could load the list in the first call to your Function and then pass those numbers through the URL for the remaining calls, so that you only need to make a request the first time.

Let me know if that helps at all.

philnash
  • 70,667
  • 10
  • 60
  • 88