JourneyJoker/sms/functions.py

14 lines
459 B
Python
Raw Normal View History

2021-05-26 12:07:52 +00:00
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)