Create send_wssp.py
Browse files- tools/send_wssp.py +16 -0
tools/send_wssp.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from twilio.rest import Client
|
| 3 |
+
|
| 4 |
+
# Find your Account SID and Auth Token at twilio.com/console
|
| 5 |
+
# and set the environment variables. See http://twil.io/secure
|
| 6 |
+
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
|
| 7 |
+
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
|
| 8 |
+
my_number = os.environ["MY_NUMBER"]
|
| 9 |
+
client = Client(account_sid, auth_token)
|
| 10 |
+
|
| 11 |
+
def send_message(number, text):
|
| 12 |
+
client.messages.create(
|
| 13 |
+
from_="whatsapp:"+my_number,
|
| 14 |
+
body=text,
|
| 15 |
+
to="whatsapp:"+number,
|
| 16 |
+
)
|