Search code examples
react-nativesmstwiliosendtwilio-api

Error on "Crypto" to use Twilio (for SMS)


I'm developing an application in React Native for iOS and I'm using Twilio to send a text message (SMS).

To use Twilio I added 2 nodes: Util and Crypto.

In my app, I only added react-native-ble-manager over util, twilio, crypto, and the basic nodes.

Adding the last node Crypto, when I include Twilio in the code, I get an error:

enter image description here

in detail:

enter image description here

Can you help me?


Solution

  • Twilio developer evangelist here.

    The Twilio Node.js library is not intended to be used in client side applications. That would require you to store or retrieve your account credentials within the app, which would make them available for a malicious user to steal and use.

    Instead, we recommend you set up a server that can perform the API requests and you make calls to that server from your application. Here's how we recommend you do that with Swift on iOS for example. We don't have an example for React Native, but as long as you can make a request to your own server from the application, then that's what you need to do.