Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fetch sales person api #10

Merged
merged 4 commits into from
Jul 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions frappe_voxbay/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,18 @@ def create_call_log(

def is_integration_enabled():
return frappe.db.get_single_value("Voxbay Settings", "enabled", True)

@frappe.whitelist(allow_guest=True)
def find_salesperson():
try:
data = json.loads(frappe.request.data)
phone_no = data.get("phone_no")

lead_own = frappe.get_value("Lead",{"phone":phone_no},"lead_owner")
sales_person_details = frappe.get_value("Voxbay Agent Settings User",{"user": lead_own},"source_number")
if not sales_person_details:
return {"success": False, "error":"Sales Person Not Found"}
return {"success":True,"sales_person": sales_person_details}
except Exception as e:
frappe.log_error(message=str(frappe.get_traceback()), title="Find sales person")
return {"success": False, "error": str(e)}
Loading