Skip to content

Commit

Permalink
Updated webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Guhan-SenSam committed Jun 16, 2024
1 parent 30bd561 commit 83d56bf
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions webhook_handler/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
from django.db.models.signals import post_save
import requests
import json
import os

@receiver(post_save)
# Webhook triggered when a new candidate is created
def handle_model_update(sender, created, instance, **kwargs):
if sender.__name__ == 'Candidate' and created:
print("hello"*100)
# send a request to the webhook
url = "https://discord.com/api/webhooks/1214916560590741564/lWDmGMRLd7cZ8Aa7-819ewdAPqUPgse6mRPGRDbtJmNom3EgSeXrKX13TODMasqYZ1fs"
data = {
Expand All @@ -22,9 +20,9 @@ def handle_model_update(sender, created, instance, **kwargs):
"url": "https://oxlac.com",
"icon_url": "https://oxlac.com/favicon.png"
},
"title": "New Candidate has applied for position " + str(instance.job_position_id),
"title": "New Candidate in " + str(instance.job_position_id),
"url": "https://employee.oxlac.com/candidate-view/" + str(instance.recruitment_id)+"/",
"description": "Candidate Name: " + instance.name + "\n" + "Email: " + instance.email,
"description": "Candidate Name: " + instance.name
}
]
}
Expand Down

0 comments on commit 83d56bf

Please sign in to comment.