Skip to content

Commit 7b61629

Browse files
author
Tony Bedford
authored
Merge pull request #66 from Nexmo/tony-brand-fix
Use NEXMO_BRAND_NAME
2 parents 4e4cff8 + 6893d82 commit 7b61629

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

example.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ NEXMO_API_SECRET='YOUR_API_SECRET'
33
TO_NUMBER='EXAMPLE_TO_NUMBER'
44
RECIPIENT_NUMBER='EXAMPLE_RECIPIENT_NUMBER'
55
FROM_NUMBER='EXAMPLE_FROM_NUMBER'
6+
NEXMO_BRAND_NAME='Acme Inc.'
67

78
# Number Insight examples
89
INSIGHT_NUMBER='NUMBER_FOR_INSIGHT'
@@ -20,4 +21,4 @@ NEXMO_NUMBER_FEATURES='SMS,VOICE'
2021
MESSAGES_APPLICATION_ID='12a3b4cd-a1b2-1ab2-a1b2-a1234bc5d678'
2122
VOICE_CALLBACK_TYPE='tel'
2223
VOICE_CALLBACK_VALUE='447700900002'
23-
VOICE_STATUS_URL='https://example.com/webhooks/status'
24+
VOICE_STATUS_URL='https://example.com/webhooks/status'

sms/send-an-sms-with-unicode.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@
88
NEXMO_API_KEY = os.getenv('NEXMO_API_KEY')
99
NEXMO_API_SECRET = os.getenv('NEXMO_API_SECRET')
1010
TO_NUMBER = os.getenv('TO_NUMBER')
11+
NEXMO_BRAND_NAME = os.getenv('NEXMO_BRAND_NAME')
1112

1213
import nexmo
1314

1415
client = nexmo.Client(key=NEXMO_API_KEY, secret=NEXMO_API_SECRET)
1516

16-
client.send_message({
17-
'from': 'Acme Inc',
17+
responseData = client.send_message({
18+
'from': NEXMO_BRAND_NAME,
1819
'to': TO_NUMBER,
1920
'text': 'こんにちは世界',
2021
'type': 'unicode',
2122
})
23+
24+
if responseData["messages"][0]["status"] == "0":
25+
print("Message sent successfully.")
26+
else:
27+
print(f"Message failed with error: {responseData['messages'][0]['error-text']}")

sms/send-an-sms.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
NEXMO_API_KEY = os.getenv("NEXMO_API_KEY")
99
NEXMO_API_SECRET = os.getenv("NEXMO_API_SECRET")
1010
TO_NUMBER = os.getenv("TO_NUMBER")
11+
NEXMO_BRAND_NAME = os.getenv('NEXMO_BRAND_NAME')
1112

1213
import nexmo
1314

0 commit comments

Comments
 (0)