We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 64056db commit 20d47a4Copy full SHA for 20d47a4
1 file changed
messages/sms/send-sms-basic-auth.py
@@ -0,0 +1,31 @@
1
+import os
2
+from os.path import dirname, join
3
+
4
+from dotenv import load_dotenv
5
6
+dotenv_path = join(dirname(__file__), "../../.env")
7
+load_dotenv(dotenv_path)
8
9
+VONAGE_API_KEY = os.getenv('VONAGE_API_KEY')
10
+VONAGE_API_SECRET = os.getenv('VONAGE_API_SECRET')
11
+MESSAGES_TO_NUMBER = os.getenv("MESSAGES_TO_NUMBER")
12
+SMS_SENDER_ID = os.getenv("SMS_SENDER_ID")
13
14
+from vonage import Auth, Vonage
15
+from vonage_messages import Sms
16
17
+client = Vonage(
18
+ Auth(
19
+ api_key=VONAGE_API_KEY,
20
+ api_secret=VONAGE_API_SECRET,
21
+ )
22
+)
23
24
+response = client.messages.send(
25
+ Sms(
26
+ to=MESSAGES_TO_NUMBER,
27
+ from_=SMS_SENDER_ID,
28
+ text='This is an SMS sent using the Vonage Messages API.',
29
30
31
+print(response)
0 commit comments