示例#1
0
def send_scheduled_message():
    destination = Destination()
    destination.to = "41793026731"

    message = Message()
    message.from_ = "Infobip"
    message.text = "This is a scheduled message"
    message.destinations = [destination]
    message.send_at = (datetime.utcnow() + timedelta(minutes=10)).isoformat()

    request = SMSAdvancedTextualRequest()
    request.messages = [message]

    return send_sms_client.execute(request)
from infobip.clients import send_multiple_textual_sms_advanced
from infobip.api.model.sms.mt.send.textual.SMSAdvancedTextualRequest import SMSAdvancedTextualRequest
from infobip.api.model.sms.mt.send.Message import Message
from infobip.api.model.Destination import Destination
from __init__ import configuration

send_sms_client = send_multiple_textual_sms_advanced(configuration)

dest = Destination()
dest.message_id = "message_123"
dest.to = "number1aaa"

message = Message()
message.flash = True
message.text = "This is an example message."
message.destinations = [dest]

request = SMSAdvancedTextualRequest()
request.messages = [message]

response = send_sms_client.execute(request)

print(response)
示例#3
0
# -*- coding: utf-8 -*-

from infobip.api.model.sms.mt.send.Tracking import Tracking
from infobip.clients import send_multiple_textual_sms_advanced
from infobip.clients import log_end_tag
from infobip.api.model.sms.mt.send.textual.SMSAdvancedTextualRequest import SMSAdvancedTextualRequest
from infobip.api.model.sms.mt.send.Message import Message
from infobip.api.model.Destination import Destination
from __init__ import configuration

send_sms_client = send_multiple_textual_sms_advanced(configuration)

dest = Destination()
dest.to = "number1aaa"

message = Message()
message.text = "This is an example message."
message.destinations = [dest]

request = SMSAdvancedTextualRequest()
request.messages = [message]

tracking = Tracking()
tracking.set_track("SMS")
request.set_tracking(tracking)

response = send_sms_client.execute(request)

print(response)

end_log_client = log_end_tag(configuration)
delivery_time_from.minute = 0

delivery_time_to = DeliveryTime()
delivery_time_to.hour = 23
delivery_time_to.minute = 59

delivery_days_list = [
    DeliveryDay.MONDAY
]

delivery_time_window = DeliveryTimeWindow()
delivery_time_window.from_ = delivery_time_from
delivery_time_window.to = delivery_time_to
delivery_time_window.days = delivery_days_list

destination = Destination()
destination.message_id = "message_222"
destination.to = "41793026731"

message = Message()
message.from_ = "123412341234"
message.text = "This is a delivery time window message"
message.destinations = [destination]
message.set_delivery_time_window(delivery_time_window)

request = SMSAdvancedTextualRequest()
request.messages = [message]

response = send_sms_client.execute(request)

print response
from infobip.clients import send_multiple_textual_sms_advanced
from infobip.api.model.sms.mt.send.textual.SMSAdvancedTextualRequest import SMSAdvancedTextualRequest
from infobip.api.model.sms.mt.send.Message import Message
from infobip.api.model.Destination import Destination
from __init__ import configuration

send_sms_client = send_multiple_textual_sms_advanced(configuration)

dest = Destination()
dest.message_id = "message_111"
dest.to = "number1aaa"

message = Message()
message.from_ = "sender1"
message.text = "This is an example message."
message.notify_url = "https://test.com/url_for_delivery_reports"
message.destinations = [dest]

dest2 = Destination()
dest2.message_id = "message_222"
dest2.to = "number2bbb"

message2 = Message()
message2.from_ = "123412341234"
message2.text = "This is an example message #2."
message2.notify_url = "https://test.com/url_for_delivery_reports_2"
message2.destinations = [dest2]

request = SMSAdvancedTextualRequest()
request.messages = [message, message2]