Files
Gainsight/Scripts/webhook_test.py
2024-09-17 16:12:57 -04:00

250 lines
7.7 KiB
Python

import json
import requests
URL = "https://webhooks.workato.com/webhooks/rest/c98e26af-6fdf-423d-b7ee-899f208956a0/doordash-activity-completion"
# DoorDash Quiz Completion
# "https://webhooks.workato.com/webhooks/rest/c98e26af-6fdf-423d-b7ee-899f208956a0/doordash-quiz-completion"
#DoorDash Course Completion
#
DATA = {
"data":{
"id":"44444444-4444-4444-4444-444444444444",
"type":"activity_completed_events",
"links":{},
"included":[
{
"id":"abcdefghi-1234-jklm-5678-nopqrstuvwxy",
"type":"people",
"links":{
"self":"https://api.northpass.com/v2/people/abcdefghi-1234-jklm-5678-nopqrstuvwxy",
"teaching":"https://app.northpass.com/people/abcdefghi-1234-jklm-5678-nopqrstuvwxy"
},
"attributes":{
"name":"Jill Smith",
"email":"jillsmith@example.com",
"sso_uid":"jillsmith@example.com",
"full_name":"Jill Smith",
"created_at":"2022-04-08T17:55:42Z",
"first_name":"Jill",
"updated_at":"2022-04-08T17:55:42Z",
"activated_at":"2022-04-08T17:55:42Z",
"unsubscribed":False,
"last_active_at":"2022-04-08T17:58:47Z"
},
"relationships":{
"school":{
"data":{
"id":"00000000-0000-0000-0000-000000000000",
"type":"schools"
}
}
}
},
{
"id":"zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzz",
"type":"courses",
"links":{
"self":"https://api.northpass.com/v2/courses/zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzz",
"build":{
"href":"https://app.northpass.com/courses/abcdefgh/builder",
"methods":[
"get"
]
},
"clone":"https://app.northpass.com/courses/abcdefgh/clone",
"preview":"/previews/courses/abcdefgh",
"teaching":"https://app.northpass.com/courses/abcdefgh"
},
"attributes":{
"name":"Onboarding 101",
"status":"live",
"for_sale":True,
"permalink":"abcdefgh",
"created_at":"2020-09-01T16:36:33Z",
"updated_at":"2022-04-08T17:58:37Z",
"list_image_url":"Image URL here",
"enrollments_count":2215,
"share_course_link":"https://subdomain.northpass.com/outline/abcdefgh/cover",
"course_enrollment_link":"https://subdomain.northpass.com/c/abcdefghijklmnopqrstuvwxyz"
},
"relationships":{
"categories":{
"data":[]
},
"instructor_partnerships":{
"data":[]
}
}
},
{
"id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type":"activities",
"links":{
"teaching":"https://app.northpass.com/courses/abcdefgh/builder/activities/ijklmnop",
"course_builder":"https://app.northpass.com/courses/abcdefgh/builder"
},
"attributes":{
"title":"Getting Started",
"course_name":"Onboarding 101"
}
}
],
"attributes":{
"value":12,
"created_at":"2022-04-08T17:58:49Z",
"course_attempt_number":1
},
"relationships":{
"course":{
"data":{
"id":"zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzz",
"type":"courses"
}
},
"person":{
"data":{
"id":"abcdefghi-1234-jklm-5678-nopqrstuvwxy",
"type":"people"
}
},
"activity":{
"data":{
"id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type":"activities"
}
}
}
}
}
HEADERS = {"content-type": "application/json"}
response = requests.post(URL, data=json.dumps(DATA))
print(response.status_code)
print(response.text)
{
"payload": {
"data": {
"id": "324198cf-cab3-444b-bb4d-ffe4d31b4f7f",
"type": "activity_completed_events",
"links": {},
"included": [
{
"id": "a88729f9-92f2-4381-ab28-4035cb4d3592",
"type": "people",
"links": {
"self": "https://api.northpass.com/v1/people/a88729f9-92f2-4381-ab28-4035cb4d3592",
"teaching": "https://app.northpass.com/people/a88729f9-92f2-4381-ab28-4035cb4d3592"
},
"attributes": {
"name": "Gus Parham",
"email": "gupar51@gmail.com",
"sso_uid": "gupar51@gmail.com",
"full_name": "Gus Parham",
"last_name": "Parham ",
"created_at": "2024-09-17T19:35:44.000000+00:00",
"first_name": "Gus",
"updated_at": "2024-09-17T20:06:26.000000+00:00",
"activated_at": "2024-09-17T19:35:44.000000+00:00",
"unsubscribed": false,
"last_active_at": "2024-09-17T20:06:26.000000+00:00"
},
"relationships": {
"school": {
"data": {
"id": "a842c0ec-e681-4bfc-b6df-97075d3ff265",
"type": "schools"
}
}
}
},
{
"id": "e918a598-a6d8-4dcd-9207-0746d0ee192a",
"type": "courses",
"links": {
"self": "https://api.northpass.com/v1/courses/e918a598-a6d8-4dcd-9207-0746d0ee192a",
"build": {
"href": "https://app.northpass.com/courses/nafkkwfx/builder",
"methods": [
"get"
]
},
"clone": "https://app.northpass.com/courses/nafkkwfx/clone",
"preview": "/previews/courses/nafkkwfx",
"teaching": "https://app.northpass.com/courses/nafkkwfx"
},
"attributes": {
"name": "DashLink Basics",
"status": "live",
"permalink": "nafkkwfx",
"created_at": "2024-05-24T19:19:00.000000+00:00",
"updated_at": "2024-09-17T20:03:43.000000+00:00",
"list_image_url": "https://cdn.filestackcontent.com/security=policy:eyJ3Ijo4MjAsImgiOjUwMCwiZml0IjoiY3JvcCIsImV4cGlyeSI6MTcyNjY1ODA4NCwiY2FsbCI6WyJyZWFkIiwiY29udmVydCIsInN0b3JlIiwicGljayIsInJlbW92ZSJdfQ==,signature:6bef5fcf0bfd2a796151ede34d792b9b0f6688b80590849cdd94cb17eeaf4ac0/resize=width:820,height:500,fit:crop/G5h4wupUQBqTrP7G78AG",
"enrollments_count": 5945,
"share_course_link": "https://doordash.northpass.com/app/courses/e918a598-a6d8-4dcd-9207-0746d0ee192a",
"course_enrollment_link": "https://doordash.northpass.com/c/e378bd4ea246bf537925b49771155a4af4ade5d9"
},
"relationships": {
"categories": {
"data": [
{
"id": "2364d17a-33ac-4652-8c85-5f93afae260c",
"type": "categories"
}
]
},
"instructor_partnerships": {
"data": []
}
}
},
{
"id": "2073e628-495f-4a8f-a61b-32b19897c1ca",
"type": "activities",
"links": {
"teaching": "https://app.northpass.com/courses/nafkkwfx/builder/activities/NjBCUq-W8",
"course_builder": "https://app.northpass.com/courses/nafkkwfx/builder"
},
"attributes": {
"title": "How to Pickup DashLink Orders?",
"course_name": "DashLink Basics"
}
}
],
"attributes": {
"value": 60,
"created_at": "2024-09-17T20:06:26.000000+00:00",
"course_attempt_number": 2
},
"relationships": {
"course": {
"data": {
"id": "e918a598-a6d8-4dcd-9207-0746d0ee192a",
"type": "courses"
}
},
"person": {
"data": {
"id": "a88729f9-92f2-4381-ab28-4035cb4d3592",
"type": "people"
}
},
"activity": {
"data": {
"id": "2073e628-495f-4a8f-a61b-32b19897c1ca",
"type": "activities"
}
}
}
}
},
"params": {}
}