Skip to content

Commit d6d7383

Browse files
author
Mark Lewin
authored
Merge pull request #89 from Nexmo/mark-update-number-update
Remove deprecated fields from Update Number snippet
2 parents 0b55de5 + 0c667ca commit d6d7383

File tree

2 files changed

+37
-39
lines changed

2 files changed

+37
-39
lines changed

.env-example

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ NEXMO_NUMBER_FEATURES=VOICE,SMS
5252
COUNTRY_CODE=GB
5353
NUMBER_SEARCH_PATTERN=234
5454
NUMBER_SEARCH_CRITERIA=1
55-
MESSAGES_APPLICATION_ID=12a3b4cd-a1b2-1ab2-a1b2-a1234bc5d678
5655
VOICE_CALLBACK_TYPE=tel
5756
VOICE_CALLBACK_VALUE=447700900002
5857
VOICE_STATUS_URL=https://example.com/webhooks/status

number/update.js

+37-38
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
1-
require('dotenv').config({ path: __dirname + '/../.env' })
1+
require('dotenv').config({ path: __dirname + '/../.env' });
22

3-
const NEXMO_API_KEY = process.env.NEXMO_API_KEY
4-
const NEXMO_API_SECRET = process.env.NEXMO_API_SECRET
5-
const NEXMO_NUMBER = process.env.NEXMO_NUMBER
6-
const COUNTRY_CODE = process.env.COUNTRY_CODE
7-
const SMS_CALLBACK_URL = process.env.SMS_CALLBACK_URL
8-
const MESSAGES_APPLICATION_ID = process.env.MESSAGES_APPLICATION_ID
9-
const VOICE_CALLBACK_TYPE = process.env.VOICE_CALLBACK_TYPE
10-
const VOICE_CALLBACK_VALUE = process.env.VOICE_CALLBACK_VALUE
11-
const VOICE_STATUS_URL = process.env.VOICE_STATUS_URL
3+
const NEXMO_API_KEY = process.env.NEXMO_API_KEY;
4+
const NEXMO_API_SECRET = process.env.NEXMO_API_SECRET;
5+
const NEXMO_NUMBER = process.env.NEXMO_NUMBER;
6+
const COUNTRY_CODE = process.env.COUNTRY_CODE;
7+
const SMS_CALLBACK_URL = process.env.SMS_CALLBACK_URL;
8+
const NEXMO_APPLICATION_ID = process.env.NEXMO_APPLICATION_ID;
9+
const VOICE_CALLBACK_TYPE = process.env.VOICE_CALLBACK_TYPE;
10+
const VOICE_CALLBACK_VALUE = process.env.VOICE_CALLBACK_VALUE;
11+
const VOICE_STATUS_URL = process.env.VOICE_STATUS_URL;
1212

13-
const Nexmo = require('nexmo')
13+
const Nexmo = require('nexmo');
1414

1515
const nexmo = new Nexmo(
16-
{
17-
apiKey: NEXMO_API_KEY,
18-
apiSecret: NEXMO_API_SECRET
19-
},
20-
{
21-
debug: true
22-
}
23-
)
16+
{
17+
apiKey: NEXMO_API_KEY,
18+
apiSecret: NEXMO_API_SECRET,
19+
},
20+
{
21+
debug: true,
22+
}
23+
);
2424

2525
nexmo.number.update(
26-
COUNTRY_CODE,
27-
NEXMO_NUMBER,
28-
{
29-
messagesCallbackType: 'app',
30-
messagesCallbackValue: MESSAGES_APPLICATION_ID,
31-
voiceCallbackType: VOICE_CALLBACK_TYPE,
32-
voiceCallbackValue: VOICE_CALLBACK_VALUE,
33-
voiceStatusCallback: VOICE_STATUS_URL,
34-
moHttpUrl: SMS_CALLBACK_URL
35-
},
36-
(err, res) => {
37-
if (err) {
38-
console.error(err)
39-
}
40-
else {
41-
console.log(JSON.stringify(res, null, 2))
42-
}
43-
}
44-
)
26+
COUNTRY_CODE,
27+
NEXMO_NUMBER,
28+
{
29+
messagesCallbackType: 'app',
30+
messagesCallbackValue: NEXMO_APPLICATION_ID,
31+
voiceCallbackType: VOICE_CALLBACK_TYPE,
32+
voiceCallbackValue: VOICE_CALLBACK_VALUE,
33+
voiceStatusCallback: VOICE_STATUS_URL,
34+
moHttpUrl: SMS_CALLBACK_URL,
35+
},
36+
(err, res) => {
37+
if (err) {
38+
console.error(err);
39+
} else {
40+
console.log(JSON.stringify(res, null, 2));
41+
}
42+
}
43+
);

0 commit comments

Comments
 (0)