You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from:'+12345678901', // From a valid Twilio number
73
+
})
74
+
.then((message) =>console.log(message.sid));
75
+
```
76
+
57
77
After a brief delay, you will receive the text message on your phone.
58
78
59
79
> **Warning**
@@ -80,6 +100,7 @@ If your environment requires SSL decryption, you can set the path to CA bundle i
80
100
81
101
If you invoke any V2010 operations without specifying an account SID, `twilio-node` will automatically use the `TWILIO_ACCOUNT_SID` value that the client was initialized with. This is useful for when you'd like to, for example, fetch resources for your main account but also your subaccount. See below:
82
102
103
+
**CommonJS:**
83
104
```javascript
84
105
// Your Account SID, Subaccount SID Auth Token from console.twilio.com
constmainAccountCalls=client.api.v2010.account.calls.list; // SID not specified, so defaults to accountSid
126
+
constsubaccountCalls=client.api.v2010.account(subaccountSid).calls.list; // SID specified as subaccountSid
127
+
```
128
+
94
129
### Lazy Loading
95
130
96
131
`twilio-node` supports lazy loading required modules for faster loading time. Lazy loading is enabled by default. To disable lazy loading, simply instantiate the Twilio client with the `lazyLoading` flag set to `false`:
97
132
133
+
**CommonJS:**
98
134
```javascript
99
135
// Your Account SID and Auth Token from console.twilio.com
// Your Account SID and Auth Token from console.twilio.com
147
+
importtwiliofrom'twilio';
148
+
149
+
constaccountSid=process.env.TWILIO_ACCOUNT_SID;
150
+
constauthToken=process.env.TWILIO_AUTH_TOKEN;
151
+
152
+
constclient=twilio(accountSid, authToken, {
153
+
lazyLoading:false,
154
+
});
155
+
```
156
+
108
157
### Enable Auto-Retry with Exponential Backoff
109
158
110
159
`twilio-node` supports automatic retry with exponential backoff when API requests receive an [Error 429 response](https://support.twilio.com/hc/en-us/articles/360044308153-Twilio-API-response-Error-429-Too-Many-Requests-). This retry with exponential backoff feature is disabled by default. To enable this feature, instantiate the Twilio client with the `autoRetry` flag set to `true`.
0 commit comments