After an issue has been raised a customer i want to send them an automatic response after 5 mins ? any idea how it can be achieved ?
To send an automatic response to a customer 5 minutes after an issue is raised, you can achieve this using a combination of Scheduled Jobs and Email Alerts or a custom Server Script.
Please check the example:
doc_events = {
"Issue": {
"after_insert": "your_app_path.send_email_response"
}
}
def send_email_response(issue):
frappe.enqueue('your_app.send_customer_response', issue=issue.name, enqueue_after_commit=True, delay=300)
def send_customer_response(issue_name):
issue = frappe.get_doc('Issue', issue_name)
if issue.contact_email:
frappe.sendmail(
recipients=[issue.contact_email],
subject='Acknowledgment of Issue Submission',
message="Thank you for raising an issue. We will get back to you shortly."
)
1 Like
@NCP bro
it shows this error
TypeError: send_email_response() takes 1 positional argument but 2 were given
It’s just example, now you have to set your logic according to the scenario.
def send_email_response(doc, event):
frappe.enqueue('your_app.send_customer_response', issue=doc.name, enqueue_after_commit=True, delay=300)
def send_customer_response(issue_name):
issue = frappe.get_doc('Issue', issue_name)
if issue.contact_email:
frappe.sendmail(
recipients=[issue.contact_email],
subject='Acknowledgment of Issue Submission',
message="Thank you for raising an issue. We will get back to you shortly."
)