Last active
May 11, 2020 01:57
-
-
Save ryanermita/e2d2193493ae76d5809a4e670c55e8fe to your computer and use it in GitHub Desktop.
explore_customer_io_anonymous_email
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import base64 | |
CUSTOMER_IO_SITE_ID='<SITE ID>' | |
CUSTOMER_IO_API_KEY='<API KEY>' | |
CUSTOMER_IO_CREDS = f'{CUSTOMER_IO_SITE_ID}:{CUSTOMER_IO_API_KEY}' | |
CUSTOMER_IO_ENCODED_CREDS = base64.b64encode(CUSTOMER_IO_CREDS.encode()).decode() | |
def send_verification_email(): | |
url = 'https://track.customer.io/api/v1/events' | |
headers = {"Authorization": f"Basic {CUSTOMER_IO_ENCODED_CREDS}", "Content-Type": "application/json"} | |
data = { | |
"name": "user_email_verification", | |
"data": { | |
"otp": "123456", | |
"source":"backend_service", | |
"recipient": "[email protected]" | |
} | |
} | |
requests.post(url, data=json.dumps(data), headers=headers, verify=False) | |
if __name__ == "__main__": | |
send_verification_email() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment