Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Add new object for mobile push message #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion FuelSDK/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,27 @@ def __init__(self):
self.endpoint = 'https://www.exacttargetapis.com/hub/v1/campaigns/{id}/assets/{assetId}'
self.urlProps = ["id", "assetId"]
self.urlPropsRequired = ["id"]


########
##
## wrap an Exact Target Push Message Contact and Deliveries
##
########
class ET_PushMessageContact(ET_CUDSupportRest):
def __init__(self):
super(ET_PushMessageContact, self).__init__()
self.endpoint = 'https://www.exacttargetapis.com/push/v1/messageContact/{messageId}/send'
self.urlProps = ["messageId"]
self.urlPropsRequired = []

class ET_PushMessageContact_Deliveries(ET_CUDSupportRest):
def __init__(self):
super(ET_PushMessageContact_Deliveries, self).__init__()
self.endpoint = 'https://www.exacttargetapis.com/push/v1/messageContact/{messageId}/deliveries/{tokenId}'
self.urlProps = ["messageId", "tokenId"]
self.urlPropsRequired = []


########
##
## wrap an Exact Target Click Event
Expand Down
41 changes: 41 additions & 0 deletions objsamples/sample_pushmessage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import ET_Client

try:
debug = False
stubObj = ET_Client.ET_Client(False, debug)

# In order for this sample to run, it needs to have a message for mobile push and a mobile push contact.
SubscriberKey = "test"
MessageID = "NDAxxxxxx"

# Push Message for contact
print '>>> Push Message for contact'
pushMessageContact = ET_Client.ET_PushMessageContact()
pushMessageContact.auth_stub = stubObj
pushMessageContact.props = {"messageId": MessageID, "SubscriberKeys": [SubscriberKey]}
pushMessageContactResponse = pushMessageContact.post()

print 'PushMessageRequest Status: ' + str(pushMessageContactResponse.status)
print 'Code: ' + str(pushMessageContactResponse.code)
print 'tokenId: ' + str(pushMessageContactResponse.results['tokenId'])
print '-----------------------------'

# Get a delivery information for mobile push message
print '>>> Get a delivery information for mobile push message'
getPushMessageDelivery = ET_Client.ET_PushMessageContact_Deliveries()
getPushMessageDelivery.auth_stub = stubObj
getPushMessageDelivery.props = {
"messageId" : MessageID,
"tokenId" : pushMessageContactResponse.results['tokenId']
}
getPushMessageDeliveryResponse = getPushMessageDelivery.get()
print 'GetRequest Status: ' + str(getPushMessageDeliveryResponse.status)
print 'Code: ' + str(getPushMessageDeliveryResponse.code)
print 'Results: ' + str(getPushMessageDeliveryResponse.results)
print 'Message: ' + str(getPushMessageDeliveryResponse.results['message'])
print 'CreateDate: ' + str(getPushMessageDeliveryResponse.results['createDate'])
print '-----------------------------'

except Exception as e:
print 'Caught exception: ' + e.message
print e