/
SMS Service (python)

NOTE: Trivore ID Documentation has moved to https://trivoreid.com

The content on this site IS OUT OF DATE!

This space has been archived!

Please go ahead to the new site!

SMS Service (python)





List of all options:

  • Get list of all supported regions

  • Send SMS message

  • Send SMS message to a user

Get list of all supported regions

regions = api.sms_service.get_supported_regions() print(regions[5:10])





[{'regionCode': 'AG', 'name': 'Antigua and Barbuda', 'callingCode': 1, 'nationalCodes': ['268'], 'flagURL': '/res/flags2/ag.png'}, {'regionCode': 'AI', 'name': 'Anguilla', 'callingCode': 1, 'nationalCodes': ['264'], 'flagURL': '/res/flags2/ai.png'}, {'regionCode': 'AL', 'name': 'Albania', 'callingCode': 355, 'nationalCodes': [], 'flagURL': '/res/flags2/al.png'}, {'regionCode': 'AM', 'name': 'Armenia', 'callingCode': 374, 'nationalCodes': [], 'flagURL': '/res/flags2/am.png'}, {'regionCode': 'AO', 'name': 'Angola', 'callingCode': 244, 'nationalCodes': [], 'flagURL': '/res/flags2/ao.png'}]



Send SMS message

from trivoreid.models.sms import SMSMessage msg = SMSMessage() msg.to = '+358401234567' msg.to_name = 'John Smith' msg.to_region = 'FI' msg.from_name = 'trivoreid' msg.messageClass = 1 msg.text = 'Example message' # send using JSON playload response = api.sms_service.send(msg, json_playload=True) # send using query parameters response2 = api.sms_service.send(msg) print(response)





{'status': 'SENT', 'description': 'Delivered to next gateway', 'messageId': 'EXAMPLEID', 'to': '+3581234567', 'toRegion': 'FI', 'messageCount': 1, 'billingState': 'FREE', 'totalPrice': 0.070111, 'remainingCredits': 0.0}



Send SMS message to a user

from trivoreid.models.sms import SMSMessage msg = SMSMessage() msg.to_name = 'John Smith' msg.to_region = 'FI' msg.from_name = 'trivoreid' msg.messageClass = 1 msg.text = 'Example message' response = api.sms_service.send_to_user(userId, msg)

Send SMS message to all group members

Sending SMS message to all primary (first) mobile numbers of users that belong to the defined groups.

message = SMSMessage({'text' : 'example text'}) api.sms_service.send_to_group_members(nsCode, message, 'groupName1', 'groupName2', 'groupName3')

SMS Service Models

SMSMessage

SMSResponse

NOTE: Trivore ID Documentation has moved to https://trivoreid.com

The content on this site IS OUT OF DATE!

This space has been archived!