Skip to content

Instantly share code, notes, and snippets.

View linkerzx's full-sized avatar

Julien Kervizic linkerzx

  • Facebook
  • London
View GitHub Profile
def auth(clientId: str,
clientSecret: str
) -> requests.Response:
end_point = "https://auth.exacttargetapis.com/v1" + "/requestToken"
headers = {'Content-type': 'application/json'}
payload = {
"clientId": clientId,
"clientSecret": clientSecret,
"accessType": "offline"
def post_to_data_extension(
accessToken: str,
dataExtensionKey: str,
items: list
) -> requests.Response:
host = "https://www.exacttargetapis.com"
end_point = "/hub/v1/dataevents/key:{key}/rowset"
url = host + end_point.format(key=dataExtensionKey)
def post_to_trigger_send(
accessToken: str,
triggeredSendDefinitionKey: str,
SubscriberKey: str,
From: dict,
Attributes: dict
) -> requests.Response:
host = "https://www.exacttargetapis.com"
end_point = "/messaging/v1/messageDefinitionSends/key:{triggeredSendDefinitionKey}/send"
def get_email_delivery_status(
accessToken: str,
key: str,
RecipientSendId: str
) -> requests.Response:
host = "https://www.exacttargetapis.com"
end_point = "/messaging/v1/messageDefinitionSends/key:{key}/deliveryRecords/{RecipientSendId}"
url = host + end_point.format(key=key,RecipientSendId=RecipientSendId)
{
"accessToken":"1ZbHNgf4mGDYV22D82x3WvZY",
"expiresIn":3479,
"refreshToken":"5ZbTNgf3mGV2V22D82x3WvVY"
}
{
"deliveryTime":"2018-07-09T16:40:33.69",
"id":"2dzf2a6c-b833-e811-a2cb-1401fc8c5d2d",
"messageId":"c222dcpc-j40d-423l-8125-79b296fh69ad",
"status":"Sent",
"to":{
"address":"[email protected]",
"id":12345,
"key":"[email protected]"
}
{
"requestId":"c222dcpc-j40d-423l-8125-79b296fh69ad",
"responses":[
{
"recipientSendId":"c222dcpc-j40d-423l-8125-79b296fh69ad",
"hasErrors":false,
"messages":["Queued"]
}
]
}
post_to_trigger_send(
myaccessKey,
"test_email_send",
"[email protected]",
{
"Address": "[email protected]",
"Name": "Julien@Original Sender"
}
,
{
ga('create', 'UA-123-01', 'auto');
@linkerzx
linkerzx / ga_jsdatalayer.js
Created October 22, 2018 22:23
setting up data from a data layer in javascript
var checkoutType;
checkoutType="Guest";
if(Checkout.data.user.email != null){
checkoutType="Loggedin";
}