JourneyJoker/sms/functions.py

14 lines
No EOL
459 B
Python

import kumisms
from dbsettings.functions import getValue
def sendMessage(recipients: list, content: str, api_key=None):
api_key = api_key or getValue("kumisms.api.key")
gateway = kumisms.KumiSMS(api_key)
for recipient in recipients:
gateway.send(recipient, content)
def sendMessageToUsers(users: list, content: str, api_key=None):
recipients = [user.phone for user in users]
return sendMessage(recipients, content, api_key)