@azure/communication-sms 1.2.0-alpha.20250417.1 → 1.2.0-alpha.20250418.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -87,6 +87,13 @@ You may also add pass in an options object to specify whether the delivery repor
87
87
  An array of `SmsSendResult` is returned. A `successful` flag is used to validate if each individual message was sent successfully.
88
88
 
89
89
  ```ts snippet:ReadmeSampleSendSms
90
+ import { DefaultAzureCredential } from "@azure/identity";
91
+ import { SmsClient } from "@azure/communication-sms";
92
+
93
+ const endpoint = "https://<resource-name>.communication.azure.com";
94
+ const credential = new DefaultAzureCredential();
95
+ const client = new SmsClient(endpoint, credential);
96
+
90
97
  const sendResults = await client.send(
91
98
  {
92
99
  from: "<from-phone-number>", // Your E.164 formatted phone number used to send SMS
@@ -113,9 +120,16 @@ for (const sendResult of sendResults) {
113
120
  To check if the recipients are in the Opt Out list, call the `check` function from the `SmsClient.optOuts` with a list of recipient phone numbers.
114
121
 
115
122
  ```ts snippet:ReadmeSampleOptOutCheck
123
+ import { DefaultAzureCredential } from "@azure/identity";
124
+ import { SmsClient } from "@azure/communication-sms";
125
+
126
+ const endpoint = "https://<resource-name>.communication.azure.com";
127
+ const credential = new DefaultAzureCredential();
128
+ const client = new SmsClient(endpoint, credential);
129
+
116
130
  const optOutCheckResults = await client.optOuts.check(
117
131
  "<from-phone-number>", // Your E.164 formatted phone number used to send SMS
118
- ["<to-phone-number-1>", "<to-phone-number-2>"], // E.164 formatted recipient phone numbers
132
+ ["<to-phone-number-1>", "<to-phone-number-2>"],
119
133
  );
120
134
 
121
135
  for (const optOutCheckResult of optOutCheckResults) {
@@ -132,12 +146,19 @@ for (const optOutCheckResult of optOutCheckResults) {
132
146
 
133
147
  ## Add a list of recipients to Opt Out list
134
148
 
135
- To add the list of recipients to Opt Out list, call the `add` function from the `SmsClient.pptOuts` with a list of recipient phone numbers.
149
+ To add the list of recipients to Opt Out list, call the `add` function from the `SmsClient.optOuts` with a list of recipient phone numbers.
136
150
 
137
151
  ```ts snippet:ReadmeSampleOptOutAdd
152
+ import { DefaultAzureCredential } from "@azure/identity";
153
+ import { SmsClient } from "@azure/communication-sms";
154
+
155
+ const endpoint = "https://<resource-name>.communication.azure.com";
156
+ const credential = new DefaultAzureCredential();
157
+ const client = new SmsClient(endpoint, credential);
158
+
138
159
  const optOutAddResults = await client.optOuts.add(
139
160
  "<from-phone-number>", // Your E.164 formatted phone number used to send SMS
140
- ["<to-phone-number-1>", "<to-phone-number-2>"], // E.164 formatted recipient phone numbers
161
+ ["<to-phone-number-1>", "<to-phone-number-2>"],
141
162
  );
142
163
 
143
164
  for (const optOutAddResult of optOutAddResults) {
@@ -157,9 +178,16 @@ for (const optOutAddResult of optOutAddResults) {
157
178
  To remove the list of recipients to Opt Out list, call the `remove` function from the `SmsClient.optOuts.` with a list of recipient phone numbers.
158
179
 
159
180
  ```ts snippet:ReadmeSampleOptOutRemove
181
+ import { DefaultAzureCredential } from "@azure/identity";
182
+ import { SmsClient } from "@azure/communication-sms";
183
+
184
+ const endpoint = "https://<resource-name>.communication.azure.com";
185
+ const credential = new DefaultAzureCredential();
186
+ const client = new SmsClient(endpoint, credential);
187
+
160
188
  const optOutRemoveResults = await client.optOuts.remove(
161
189
  "<from-phone-number>", // Your E.164 formatted phone number used to send SMS
162
- ["<to-phone-number-1>", "<to-phone-number-2>"], // E.164 formatted recipient phone numbers
190
+ ["<to-phone-number-1>", "<to-phone-number-2>"],
163
191
  );
164
192
 
165
193
  for (const optOutRemoveResult of optOutRemoveResults) {
@@ -181,6 +209,13 @@ Exceptions will not be thrown if the error is caused by an individual message, o
181
209
  Please use the `successful` flag to validate each individual result to verify if the message was sent.
182
210
 
183
211
  ```ts snippet:ReadmeSampleSendSmsErrorHandling
212
+ import { DefaultAzureCredential } from "@azure/identity";
213
+ import { SmsClient } from "@azure/communication-sms";
214
+
215
+ const endpoint = "https://<resource-name>.communication.azure.com";
216
+ const credential = new DefaultAzureCredential();
217
+ const client = new SmsClient(endpoint, credential);
218
+
184
219
  try {
185
220
  const sendResults = await client.send({
186
221
  from: "<from-phone-number>", // Your E.164 formatted phone number used to send SMS
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.3"
8
+ "packageVersion": "7.52.4"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/communication-sms",
3
- "version": "1.2.0-alpha.20250417.1",
3
+ "version": "1.2.0-alpha.20250418.1",
4
4
  "description": "SDK for Azure Communication SMS service which facilitates the sending of SMS messages.",
5
5
  "sdk-type": "client",
6
6
  "main": "./dist/commonjs/index.js",