Files
Gainsight/Scripts/webhook_test.py

259 lines
10 KiB
Python
Raw Permalink Normal View History

2023-11-10 20:36:38 -05:00
import json
import requests
# URL = "https://webhooks.workato.com/webhooks/rest/c98e26af-6fdf-423d-b7ee-899f208956a0/doordash-activity-completion"
URL = "https://webhooks.workato.com/webhooks/rest/604b4fc0-fcd9-4f3b-b715-b42d7f740ba6/domains-updated"
# DoorDash Quiz Completion
# "https://webhooks.workato.com/webhooks/rest/c98e26af-6fdf-423d-b7ee-899f208956a0/doordash-quiz-completion"
# DoorDash Course Completion
#
DATA = anthology_payload = {
"domain_to_update": {
"domain": "tcl.edu",
"group_ids": [
"8302b674-c728-42d2-9ba3-908b4d970436",
"2b5267b2-ce87-4e77-ad88-5cfec80496b9",
"197da27d-0497-40b5-b2f8-cec4124d32f6",
"dc50ca43-5071-45b3-bf42-e1e64416ffd0",
],
},
"params": {},
2023-11-10 20:36:38 -05:00
}
# 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"
# }
# }
# }
# }
# }
#
2023-11-10 20:36:38 -05:00
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": {},
# }