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

How to easily access SubscriberID from BounceEvent #96

Open
jb-leblanc opened this issue Jun 26, 2018 · 0 comments
Open

How to easily access SubscriberID from BounceEvent #96

jb-leblanc opened this issue Jun 26, 2018 · 0 comments

Comments

@jb-leblanc
Copy link

As described in the Salesforce documentation ( https://help.salesforce.com/articleView?id=mc_as_bounces.htm&type=5 ), Bounce event contains those following info :
"ClientID","SendID","SubscriberKey","SubscriberID","ListID","EventDate","EventType","BounceCategory","SMTPCode","BounceReason","BatchID","TriggeredSendExternalKey".

I want to get a dict with those columns, but when I specify columns I want to access in the properties, SubscriberID and ListID are not directectly accessible.
getBounceEvent.props = ["ClientID","SendID","SubscriberKey","SubscriberID","ListID","EventDate","EventType","BounceCategory","SMTPCode","BounceReason","BatchID","TriggeredSendExternalKey"]
results to :
Message: Error: The Request Property(s) SubscriberID,ListID do not match with the fields of BounceEvent retrieve

I reached my goal by calling each time a function that finds the SubscriberID with the SubscriberKey : SubscriberId = get_subscriber_id_with_key(SubscriberKey) :

def get_subscriber_id_with_key(SubscriberKey):
    import ET_Client
    try:
        debug = False
        stubObj = ET_Client.ET_Client(False, debug)
        
        getSub = ET_Client.ET_Subscriber()
        getSub.auth_stub = stubObj
        getSub.props = ["SubscriberKey", "Subscriber.ID"]
        getSub.search_filter = {'Property' : 'SubscriberKey','SimpleOperator' : 'equals','Value' : SubscriberKey}
        getResponse = getSub.get()
        
        dict = getResponse.results
        
        return dict[0][1]
    
    except Exception as e:
        print('Caught exception: ' + str(e.message))
        print(e)

But it takes a way too much time...

Is there a best way to do it ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant