├── mansico_meta_integration ├── config │ └── __init__.py ├── public │ └── .gitkeep ├── www │ └── __init__.py ├── templates │ ├── __init__.py │ └── pages │ │ └── __init__.py ├── __init__.py ├── mansico_meta_integration │ ├── __init__.py │ ├── doctype │ │ ├── __init__.py │ │ ├── page_id │ │ │ ├── __init__.py │ │ │ ├── page_id.js │ │ │ ├── test_page_id.py │ │ │ ├── page_id.py │ │ │ └── page_id.json │ │ ├── meta_forms │ │ │ ├── __init__.py │ │ │ ├── meta_forms.py │ │ │ └── meta_forms.json │ │ ├── sync_new_add │ │ │ ├── __init__.py │ │ │ ├── sync_new_add.js │ │ │ ├── test_sync_new_add.py │ │ │ ├── meta_integraion_objects.py │ │ │ ├── sync_new_add.json │ │ │ └── sync_new_add.py │ │ ├── map_lead_field │ │ │ ├── __init__.py │ │ │ ├── map_lead_field.py │ │ │ └── map_lead_field.json │ │ └── meta_facebook_settings │ │ │ ├── __init__.py │ │ │ ├── meta_facebook_settings.js │ │ │ ├── test_meta_facebook_settings.py │ │ │ ├── meta_facebook_settings.py │ │ │ └── meta_facebook_settings.json │ ├── workspace │ │ └── meta_leads │ │ │ └── meta_leads.json │ └── custom │ │ ├── note.json │ │ └── lead.json ├── modules.txt ├── patches.txt ├── hooks.py ├── overrides.py └── tasks.py ├── .gitignore ├── pyproject.toml ├── CHANGELOG.md ├── license.txt └── README.md /mansico_meta_integration/config/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mansico_meta_integration/public/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mansico_meta_integration/www/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mansico_meta_integration/templates/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mansico_meta_integration/templates/pages/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mansico_meta_integration/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = "1.2.1" 2 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mansico_meta_integration/modules.txt: -------------------------------------------------------------------------------- 1 | Mansico Meta Integration -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/page_id/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/meta_forms/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/sync_new_add/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/map_lead_field/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/meta_facebook_settings/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.pyc 3 | *.egg-info 4 | *.swp 5 | tags 6 | node_modules 7 | __pycache__ -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/page_id/page_id.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024, Mansy and contributors 2 | // For license information, please see license.txt 3 | 4 | // frappe.ui.form.on("Page ID", { 5 | // refresh(frm) { 6 | 7 | // }, 8 | // }); 9 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/sync_new_add/sync_new_add.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023, mansy and contributors 2 | // For license information, please see license.txt 3 | 4 | // frappe.ui.form.on("Sync New Add", { 5 | // refresh(frm) { 6 | 7 | // }, 8 | // }); 9 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/page_id/test_page_id.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024, Mansy and Contributors 2 | # See license.txt 3 | 4 | # import frappe 5 | from frappe.tests.utils import FrappeTestCase 6 | 7 | 8 | class TestPageID(FrappeTestCase): 9 | pass 10 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/page_id/page_id.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024, Mansy and contributors 2 | # For license information, please see license.txt 3 | 4 | # import frappe 5 | from frappe.model.document import Document 6 | 7 | 8 | class PageID(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/sync_new_add/test_sync_new_add.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024, Mansy and Contributors 2 | # See license.txt 3 | 4 | # import frappe 5 | from frappe.tests.utils import FrappeTestCase 6 | 7 | 8 | class TestSyncNewAdd(FrappeTestCase): 9 | pass 10 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/meta_forms/meta_forms.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024, Mansy and contributors 2 | # For license information, please see license.txt 3 | 4 | # import frappe 5 | from frappe.model.document import Document 6 | 7 | 8 | class MetaForms(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/meta_facebook_settings/meta_facebook_settings.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024, Mansy and contributors 2 | // For license information, please see license.txt 3 | 4 | // frappe.ui.form.on("Meta Facebook Settings", { 5 | // refresh(frm) { 6 | 7 | // }, 8 | // }); 9 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/map_lead_field/map_lead_field.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2025, Mansy and contributors 2 | # For license information, please see license.txt 3 | 4 | # import frappe 5 | from frappe.model.document import Document 6 | 7 | 8 | class MapLeadField(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/meta_facebook_settings/test_meta_facebook_settings.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024, Mansy and Contributors 2 | # See license.txt 3 | 4 | # import frappe 5 | from frappe.tests.utils import FrappeTestCase 6 | 7 | 8 | class TestMetaFacebookSettings(FrappeTestCase): 9 | pass 10 | -------------------------------------------------------------------------------- /mansico_meta_integration/patches.txt: -------------------------------------------------------------------------------- 1 | [pre_model_sync] 2 | # Patches added in this section will be executed before doctypes are migrated 3 | # Read docs to understand patches: https://frappeframework.com/docs/v14/user/en/database-migrations 4 | 5 | [post_model_sync] 6 | # Patches added in this section will be executed after doctypes are migrated -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/meta_facebook_settings/meta_facebook_settings.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024, Mansy and contributors 2 | # For license information, please see license.txt 3 | 4 | # import frappe 5 | from frappe.model.document import Document 6 | 7 | 8 | class MetaFacebookSettings(Document): 9 | pass 10 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "mansico_meta_integration" 3 | authors = [ 4 | { name = "Mansy", email = "ahmedmansy265@gmail.com"} 5 | ] 6 | description = "This project is about syncing Facebook leads with ERPnext, When Clients fill Facebook ads instant forms app automatic fetch new created leads and create lead automatic in Lead doctype. Also on changing the Lead Status the new status sent to meta Pixel." 7 | requires-python = ">=3.10" 8 | readme = "README.md" 9 | dynamic = ["version"] 10 | dependencies = [ 11 | # "frappe~=15.0.0" # Installed and managed by bench. 12 | ] 13 | 14 | [build-system] 15 | requires = ["flit_core >=3.4,<4"] 16 | build-backend = "flit_core.buildapi" 17 | 18 | # These dependencies are only installed when developer mode is enabled 19 | [tool.bench.dev-dependencies] 20 | # package_name = "~=1.1.0" 21 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [Unreleased] 4 | 5 | ## [1.2.1] 6 | ### Added 7 | - **fix wrong release version** 8 | 9 | ## [1.2.0] 10 | ### Added 11 | - **Support Facebook Fields Datatypes** 12 | - Bug fixes and improvements. 13 | 14 | ## [1.1.0] - 2025-02-09 15 | - **Dynamic Lead Field Mapping**: Introduced dynamic mapping in the `create_lead` method. Now, you can customize which form fields are mapped to lead fields. This adds flexibility when dealing with different field names. 16 | - **No Mandatory `email_id` for Lead**: Removed the mandatory requirement for `email_id` when creating a Lead. Only `first_name` is now required to create a Lead. 17 | - **Improved Error Handling**: Refined error handling logic to provide better error reporting and debugging capabilities during integration. 18 | 19 | ### Fixed 20 | - **Bug Fixes**: Fixed various issues related to lead processing and integration logic. 21 | 22 | ## [1.0.0] - 2025-02-01 23 | ### Added 24 | - **Initial Release**: Launched the first version of Mansico Meta Integration, which includes support for importing leads from Facebook via the Facebook Lead Ads API. 25 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Ahmed Mansy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /mansico_meta_integration/hooks.py: -------------------------------------------------------------------------------- 1 | app_name = "mansico_meta_integration" 2 | app_title = "Mansico Meta Integration" 3 | app_publisher = "Mansy" 4 | app_description = "This project is about syncing Facebook leads with ERPnext, When Clients fill Facebook ads instant forms app automatic fetch new created leads and create lead automatic in Lead doctype. Also on changing the Lead Status the new status sent to meta Pixel." 5 | app_email = "ahmedmansy265@gmail.com" 6 | app_license = "mit" 7 | required_apps = ["erpnext"] 8 | 9 | doc_events = { 10 | "Lead": { 11 | # will run before a ToDo record is inserted into database 12 | "validate": "mansico_meta_integration.overrides.validate_lead", 13 | } 14 | } 15 | 16 | 17 | doc_events["CRM Lead"] = { 18 | "validate": "mansico_meta_integration.overrides.validate_crmlead", 19 | } 20 | # Scheduled Tasks 21 | # --------------- 22 | 23 | scheduler_events = { 24 | "all": [ 25 | "mansico_meta_integration.tasks.all" 26 | ], 27 | "daily": [ 28 | "mansico_meta_integration.tasks.daily" 29 | ], 30 | "hourly": [ 31 | "mansico_meta_integration.tasks.hourly" 32 | ], 33 | "weekly": [ 34 | "mansico_meta_integration.tasks.weekly" 35 | ], 36 | "monthly": [ 37 | "mansico_meta_integration.tasks.monthly" 38 | ], 39 | } 40 | -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/sync_new_add/meta_integraion_objects.py: -------------------------------------------------------------------------------- 1 | class UserData: 2 | def __init__(self, lead_id): 3 | self.lead_id = lead_id 4 | 5 | def to_dict(self): 6 | return { 7 | "lead_id": self.lead_id 8 | } 9 | 10 | class CustomData: 11 | def __init__(self, event_source, lead_event_source): 12 | self.event_source = event_source 13 | self.lead_event_source = lead_event_source 14 | 15 | def to_dict(self): 16 | return { 17 | "event_source": self.event_source, 18 | "lead_event_source": self.lead_event_source 19 | } 20 | class Payload: 21 | def __init__(self, event_name, event_time, action_source, user_data, custom_data): 22 | self.event_name = event_name 23 | self.event_time = event_time 24 | self.action_source = action_source 25 | self.user_data = user_data 26 | self.custom_data = custom_data 27 | 28 | def to_dict(self): 29 | return { 30 | "event_name": self.event_name, 31 | "event_time": self.event_time, 32 | "action_source": self.action_source, 33 | "user_data": self.user_data.to_dict(), 34 | "custom_data": self.custom_data.to_dict() 35 | } -------------------------------------------------------------------------------- /mansico_meta_integration/overrides.py: -------------------------------------------------------------------------------- 1 | import frappe 2 | from frappe.utils.scheduler import is_scheduler_disabled 3 | from frappe import _ 4 | from mansico_meta_integration.mansico_meta_integration.doctype.sync_new_add.sync_new_add import FetchLeads 5 | 6 | def validate_lead(doc, method=None): 7 | _validate_lead_status_change(doc, "Lead") 8 | 9 | def validate_crmlead(doc, method=None): 10 | _validate_lead_status_change(doc, "CRM Lead") 11 | 12 | def _validate_lead_status_change(doc, doctype): 13 | """ 14 | Helper function to validate status change and trigger Facebook lead creation. 15 | """ 16 | if is_scheduler_disabled(): 17 | frappe.throw(_("Please enable the Scheduler first.")) 18 | 19 | if not doc.is_new() and doc.custom_meta_lead_id: 20 | old_doc = doc.get_doc_before_save() 21 | if old_doc and old_doc.status != doc.status: 22 | try: 23 | lead = frappe.get_doc(doctype, doc.name) 24 | FetchLeads.create_lead_in_facebook(lead) 25 | except Exception as e: 26 | frappe.log_error( 27 | title=f"Error in {doctype} Facebook Lead Creation", 28 | message=f"An error occurred while creating a Facebook lead for {doctype} {doc.name}: {str(e)}" 29 | ) -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/map_lead_field/map_lead_field.json: -------------------------------------------------------------------------------- 1 | { 2 | "actions": [], 3 | "allow_rename": 1, 4 | "creation": "2025-02-09 17:55:46.121568", 5 | "doctype": "DocType", 6 | "editable_grid": 1, 7 | "engine": "InnoDB", 8 | "field_order": [ 9 | "form_field", 10 | "form_field_label", 11 | "form_field_type", 12 | "lead_field" 13 | ], 14 | "fields": [ 15 | { 16 | "fieldname": "form_field", 17 | "fieldtype": "Data", 18 | "in_list_view": 1, 19 | "label": "Form Field", 20 | "read_only": 1 21 | }, 22 | { 23 | "fieldname": "form_field_label", 24 | "fieldtype": "Data", 25 | "in_list_view": 1, 26 | "label": "Form Field Label", 27 | "read_only": 1 28 | }, 29 | { 30 | "fieldname": "form_field_type", 31 | "fieldtype": "Data", 32 | "in_list_view": 1, 33 | "label": "Form Field Type", 34 | "read_only": 1 35 | }, 36 | { 37 | "fieldname": "lead_field", 38 | "fieldtype": "Data", 39 | "in_list_view": 1, 40 | "label": "Lead Field Name", 41 | "reqd": 1 42 | } 43 | ], 44 | "index_web_pages_for_search": 1, 45 | "istable": 1, 46 | "links": [], 47 | "modified": "2025-02-09 19:24:01.715671", 48 | "modified_by": "Administrator", 49 | "module": "Mansico Meta Integration", 50 | "name": "Map Lead Field", 51 | "owner": "Administrator", 52 | "permissions": [], 53 | "sort_field": "modified", 54 | "sort_order": "DESC", 55 | "states": [] 56 | } -------------------------------------------------------------------------------- /mansico_meta_integration/tasks.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import frappe 4 | from mansico_meta_integration.mansico_meta_integration.doctype.sync_new_add.sync_new_add import FetchLeads 5 | 6 | 7 | @frappe.whitelist() 8 | def all(): 9 | sync_new_add = frappe.db.get_all("Sync New Add", {"event_frequency": "All", "docstatus": 1}, pluck="name") 10 | for name in sync_new_add: 11 | fetch = FetchLeads(name) 12 | fetch.fetch_leads() 13 | 14 | @frappe.whitelist() 15 | def daily(): 16 | sync_new_add = frappe.db.get_all("Sync New Add", {"event_frequency": "Daily", "docstatus": 1}, pluck="name") 17 | for name in sync_new_add: 18 | fetch = FetchLeads(name) 19 | fetch.fetch_leads() 20 | 21 | @frappe.whitelist() 22 | def hourly(): 23 | sync_new_add = frappe.db.get_all("Sync New Add", {"event_frequency": "Hourly", "docstatus": 1}, pluck="name") 24 | for name in sync_new_add: 25 | fetch = FetchLeads(name) 26 | fetch.fetch_leads() 27 | 28 | @frappe.whitelist() 29 | def weekly(): 30 | sync_new_add = frappe.db.get_all("Sync New Add", {"event_frequency": "Weekly", "docstatus": 1}, pluck="name") 31 | for name in sync_new_add: 32 | fetch = FetchLeads(name) 33 | fetch.fetch_leads() 34 | 35 | @frappe.whitelist() 36 | def monthly(): 37 | sync_new_add = frappe.db.get_all("Sync New Add", {"event_frequency": "Monthly", "docstatus": 1}, pluck="name") 38 | for name in sync_new_add: 39 | fetch = FetchLeads(name) 40 | fetch.fetch_leads() -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/meta_forms/meta_forms.json: -------------------------------------------------------------------------------- 1 | { 2 | "actions": [], 3 | "allow_rename": 1, 4 | "creation": "2024-01-12 04:02:17.085239", 5 | "default_view": "List", 6 | "doctype": "DocType", 7 | "editable_grid": 1, 8 | "engine": "InnoDB", 9 | "field_order": [ 10 | "form_id", 11 | "form_name", 12 | "created_time", 13 | "leads_count", 14 | "page", 15 | "questions" 16 | ], 17 | "fields": [ 18 | { 19 | "fieldname": "form_id", 20 | "fieldtype": "Data", 21 | "in_list_view": 1, 22 | "label": "Form Id", 23 | "read_only": 1 24 | }, 25 | { 26 | "fieldname": "form_name", 27 | "fieldtype": "Data", 28 | "in_list_view": 1, 29 | "label": "Form", 30 | "read_only": 1 31 | }, 32 | { 33 | "fieldname": "created_time", 34 | "fieldtype": "Data", 35 | "in_list_view": 1, 36 | "label": "created_time", 37 | "read_only": 1 38 | }, 39 | { 40 | "fieldname": "leads_count", 41 | "fieldtype": "Data", 42 | "in_list_view": 1, 43 | "label": "leads_count", 44 | "read_only": 1 45 | }, 46 | { 47 | "fieldname": "page", 48 | "fieldtype": "JSON", 49 | "in_list_view": 1, 50 | "label": "page", 51 | "read_only": 1 52 | }, 53 | { 54 | "fieldname": "questions", 55 | "fieldtype": "JSON", 56 | "label": "questions", 57 | "read_only": 1 58 | } 59 | ], 60 | "index_web_pages_for_search": 1, 61 | "istable": 1, 62 | "links": [], 63 | "modified": "2024-01-12 04:02:17.085239", 64 | "modified_by": "Administrator", 65 | "module": "Mansico Meta Integration", 66 | "name": "Meta Forms", 67 | "owner": "Administrator", 68 | "permissions": [], 69 | "sort_field": "modified", 70 | "sort_order": "DESC", 71 | "states": [] 72 | } -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/workspace/meta_leads/meta_leads.json: -------------------------------------------------------------------------------- 1 | { 2 | "charts": [], 3 | "content": "[{\"id\":\"kV9jRvU-En\",\"type\":\"card\",\"data\":{\"card_name\":\"Facebook Integration\",\"col\":4}}]", 4 | "creation": "2024-01-12 04:12:45.415313", 5 | "custom_blocks": [], 6 | "docstatus": 0, 7 | "doctype": "Workspace", 8 | "for_user": "", 9 | "hide_custom": 0, 10 | "icon": "color-review-points", 11 | "idx": 0, 12 | "indicator_color": "green", 13 | "is_hidden": 0, 14 | "label": "Meta Leads", 15 | "links": [ 16 | { 17 | "description": "Welcome To Mansico Meta Integration Go throw the doctypes below sequentially", 18 | "hidden": 0, 19 | "is_query_report": 0, 20 | "label": "Facebook Integration", 21 | "link_count": 3, 22 | "link_type": "DocType", 23 | "onboard": 0, 24 | "type": "Card Break" 25 | }, 26 | { 27 | "hidden": 0, 28 | "is_query_report": 0, 29 | "label": "Meta Facebook Settings", 30 | "link_count": 0, 31 | "link_to": "Meta Facebook Settings", 32 | "link_type": "DocType", 33 | "onboard": 0, 34 | "type": "Link" 35 | }, 36 | { 37 | "hidden": 0, 38 | "is_query_report": 0, 39 | "label": "Page ID", 40 | "link_count": 0, 41 | "link_to": "Page ID", 42 | "link_type": "DocType", 43 | "onboard": 0, 44 | "type": "Link" 45 | }, 46 | { 47 | "hidden": 0, 48 | "is_query_report": 0, 49 | "label": "Sync Leads", 50 | "link_count": 0, 51 | "link_to": "Sync New Add", 52 | "link_type": "DocType", 53 | "onboard": 0, 54 | "type": "Link" 55 | } 56 | ], 57 | "modified": "2025-02-09 20:20:35.643671", 58 | "modified_by": "Administrator", 59 | "module": "Mansico Meta Integration", 60 | "name": "Meta Leads", 61 | "number_cards": [], 62 | "owner": "Administrator", 63 | "parent_page": "", 64 | "public": 1, 65 | "quick_lists": [], 66 | "roles": [], 67 | "sequence_id": 1.0, 68 | "shortcuts": [], 69 | "title": "Meta Leads" 70 | } -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/page_id/page_id.json: -------------------------------------------------------------------------------- 1 | { 2 | "actions": [], 3 | "allow_rename": 1, 4 | "autoname": "field:page_id", 5 | "creation": "2024-01-12 04:02:35.302590", 6 | "default_view": "List", 7 | "doctype": "DocType", 8 | "engine": "InnoDB", 9 | "field_order": [ 10 | "page_id", 11 | "name1", 12 | "pixel_id", 13 | "pixel_access_token", 14 | "page_json" 15 | ], 16 | "fields": [ 17 | { 18 | "allow_in_quick_entry": 1, 19 | "fieldname": "page_id", 20 | "fieldtype": "Data", 21 | "in_list_view": 1, 22 | "label": "Page ID", 23 | "reqd": 1, 24 | "unique": 1 25 | }, 26 | { 27 | "allow_in_quick_entry": 1, 28 | "fieldname": "name1", 29 | "fieldtype": "Data", 30 | "label": "Page Name", 31 | "reqd": 1 32 | }, 33 | { 34 | "fieldname": "page_json", 35 | "fieldtype": "JSON", 36 | "label": "page_json", 37 | "read_only": 1 38 | }, 39 | { 40 | "fieldname": "pixel_access_token", 41 | "fieldtype": "Small Text", 42 | "label": "Pixel Access Token", 43 | "reqd": 1 44 | }, 45 | { 46 | "fieldname": "pixel_id", 47 | "fieldtype": "Data", 48 | "in_list_view": 1, 49 | "in_standard_filter": 1, 50 | "label": "Pixel ID", 51 | "reqd": 1 52 | } 53 | ], 54 | "index_web_pages_for_search": 1, 55 | "links": [], 56 | "modified": "2025-02-12 21:30:54.210403", 57 | "modified_by": "Administrator", 58 | "module": "Mansico Meta Integration", 59 | "name": "Page ID", 60 | "naming_rule": "By fieldname", 61 | "owner": "Administrator", 62 | "permissions": [ 63 | { 64 | "create": 1, 65 | "delete": 1, 66 | "email": 1, 67 | "export": 1, 68 | "print": 1, 69 | "read": 1, 70 | "report": 1, 71 | "role": "System Manager", 72 | "share": 1, 73 | "write": 1 74 | } 75 | ], 76 | "quick_entry": 1, 77 | "show_title_field_in_link": 1, 78 | "sort_field": "modified", 79 | "sort_order": "DESC", 80 | "states": [], 81 | "title_field": "name1" 82 | } -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/meta_facebook_settings/meta_facebook_settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "actions": [], 3 | "allow_rename": 1, 4 | "creation": "2024-01-12 04:03:00.629477", 5 | "default_view": "List", 6 | "doctype": "DocType", 7 | "engine": "InnoDB", 8 | "field_order": [ 9 | "section_break_0lkx", 10 | "access_token", 11 | "graph_api_version", 12 | "api_url", 13 | "audience_name", 14 | "column_break_nezf", 15 | "app_secret", 16 | "app_id", 17 | "ad_account_id", 18 | "audience_retention_days" 19 | ], 20 | "fields": [ 21 | { 22 | "fieldname": "section_break_0lkx", 23 | "fieldtype": "Section Break" 24 | }, 25 | { 26 | "fieldname": "app_secret", 27 | "fieldtype": "Data", 28 | "label": "App Secret" 29 | }, 30 | { 31 | "fieldname": "audience_name", 32 | "fieldtype": "Data", 33 | "label": "Audience Name" 34 | }, 35 | { 36 | "fieldname": "graph_api_version", 37 | "fieldtype": "Data", 38 | "in_list_view": 1, 39 | "label": "Graph API Version", 40 | "reqd": 1 41 | }, 42 | { 43 | "fieldname": "column_break_nezf", 44 | "fieldtype": "Column Break" 45 | }, 46 | { 47 | "fieldname": "access_token", 48 | "fieldtype": "Data", 49 | "in_list_view": 1, 50 | "label": "Access Tocken", 51 | "reqd": 1 52 | }, 53 | { 54 | "fieldname": "ad_account_id", 55 | "fieldtype": "Data", 56 | "label": "AD Account ID" 57 | }, 58 | { 59 | "fieldname": "audience_retention_days", 60 | "fieldtype": "Data", 61 | "label": "Audience Retention Days" 62 | }, 63 | { 64 | "fieldname": "app_id", 65 | "fieldtype": "Data", 66 | "label": "App ID" 67 | }, 68 | { 69 | "fieldname": "api_url", 70 | "fieldtype": "Data", 71 | "label": "API URL", 72 | "reqd": 1 73 | } 74 | ], 75 | "index_web_pages_for_search": 1, 76 | "issingle": 1, 77 | "links": [], 78 | "modified": "2025-02-12 21:58:54.139663", 79 | "modified_by": "Administrator", 80 | "module": "Mansico Meta Integration", 81 | "name": "Meta Facebook Settings", 82 | "owner": "Administrator", 83 | "permissions": [ 84 | { 85 | "create": 1, 86 | "delete": 1, 87 | "email": 1, 88 | "print": 1, 89 | "read": 1, 90 | "role": "System Manager", 91 | "share": 1, 92 | "write": 1 93 | } 94 | ], 95 | "sort_field": "modified", 96 | "sort_order": "DESC", 97 | "states": [] 98 | } -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/custom/note.json: -------------------------------------------------------------------------------- 1 | { 2 | "custom_fields": [ 3 | { 4 | "_assign": null, 5 | "_comments": null, 6 | "_liked_by": null, 7 | "_user_tags": null, 8 | "allow_in_quick_entry": 0, 9 | "allow_on_submit": 0, 10 | "bold": 0, 11 | "collapsible": 0, 12 | "collapsible_depends_on": null, 13 | "columns": 0, 14 | "creation": "2024-01-12 04:18:02.270770", 15 | "default": null, 16 | "depends_on": null, 17 | "description": null, 18 | "docstatus": 0, 19 | "dt": "Note", 20 | "fetch_from": null, 21 | "fetch_if_empty": 0, 22 | "fieldname": "custom_reference_name", 23 | "fieldtype": "Link", 24 | "hidden": 0, 25 | "hide_border": 0, 26 | "hide_days": 0, 27 | "hide_seconds": 0, 28 | "idx": 6, 29 | "ignore_user_permissions": 0, 30 | "ignore_xss_filter": 0, 31 | "in_global_search": 0, 32 | "in_list_view": 0, 33 | "in_preview": 0, 34 | "in_standard_filter": 0, 35 | "insert_after": "content", 36 | "is_system_generated": 0, 37 | "is_virtual": 0, 38 | "label": "Reference Name", 39 | "length": 0, 40 | "mandatory_depends_on": null, 41 | "modified": "2024-01-12 04:18:02.270770", 42 | "modified_by": "Administrator", 43 | "module": null, 44 | "name": "Note-custom_reference_name", 45 | "no_copy": 0, 46 | "non_negative": 0, 47 | "options": "Lead", 48 | "owner": "Administrator", 49 | "permlevel": 0, 50 | "precision": "", 51 | "print_hide": 0, 52 | "print_hide_if_no_value": 0, 53 | "print_width": null, 54 | "read_only": 1, 55 | "read_only_depends_on": null, 56 | "report_hide": 0, 57 | "reqd": 0, 58 | "search_index": 0, 59 | "sort_options": 0, 60 | "translatable": 0, 61 | "unique": 0, 62 | "width": null 63 | } 64 | ], 65 | "custom_perms": [], 66 | "doctype": "Note", 67 | "links": [], 68 | "property_setters": [ 69 | { 70 | "_assign": null, 71 | "_comments": null, 72 | "_liked_by": null, 73 | "_user_tags": null, 74 | "creation": "2024-01-12 04:18:02.169047", 75 | "default_value": null, 76 | "doc_type": "Note", 77 | "docstatus": 0, 78 | "doctype_or_field": "DocType", 79 | "field_name": null, 80 | "idx": 0, 81 | "is_system_generated": 0, 82 | "modified": "2024-01-12 04:18:02.169047", 83 | "modified_by": "Administrator", 84 | "module": null, 85 | "name": "Note-main-field_order", 86 | "owner": "Administrator", 87 | "property": "field_order", 88 | "property_type": "Data", 89 | "row_name": null, 90 | "value": "[\"title\", \"public\", \"notify_on_login\", \"notify_on_every_login\", \"expire_notification_on\", \"content\", \"reference_name\", \"seen_by_section\", \"seen_by\"]" 91 | } 92 | ], 93 | "sync_on_migrate": 1 94 | } -------------------------------------------------------------------------------- /mansico_meta_integration/mansico_meta_integration/doctype/sync_new_add/sync_new_add.json: -------------------------------------------------------------------------------- 1 | { 2 | "actions": [], 3 | "allow_rename": 1, 4 | "autoname": "naming_series:", 5 | "creation": "2024-01-12 04:09:09.565387", 6 | "default_view": "List", 7 | "doctype": "DocType", 8 | "engine": "InnoDB", 9 | "field_order": [ 10 | "section_break_qhoi", 11 | "column_break_rlez", 12 | "column_break_jjze", 13 | "naming_series", 14 | "section_break_msmq", 15 | "based_on", 16 | "page_id", 17 | "column_break_blgv", 18 | "lead_doctype_name", 19 | "event_frequency", 20 | "section_break_snbb", 21 | "fetch_map_lead_fields", 22 | "map_lead_fields", 23 | "meta_forms_section", 24 | "force_fetch", 25 | "table_hsya", 26 | "amended_from" 27 | ], 28 | "fields": [ 29 | { 30 | "fieldname": "section_break_qhoi", 31 | "fieldtype": "Section Break", 32 | "read_only": 1 33 | }, 34 | { 35 | "fieldname": "amended_from", 36 | "fieldtype": "Link", 37 | "label": "Amended From", 38 | "no_copy": 1, 39 | "options": "Sync New Add", 40 | "print_hide": 1, 41 | "read_only": 1, 42 | "search_index": 1 43 | }, 44 | { 45 | "fieldname": "column_break_jjze", 46 | "fieldtype": "Column Break" 47 | }, 48 | { 49 | "fieldname": "naming_series", 50 | "fieldtype": "Select", 51 | "hidden": 1, 52 | "label": "naming_series", 53 | "options": "AD-SYNC-" 54 | }, 55 | { 56 | "fieldname": "based_on", 57 | "fieldtype": "Select", 58 | "in_list_view": 1, 59 | "label": "Based On", 60 | "options": "\nPage ID", 61 | "reqd": 1 62 | }, 63 | { 64 | "fieldname": "section_break_msmq", 65 | "fieldtype": "Section Break" 66 | }, 67 | { 68 | "depends_on": "eval:doc.based_on==\"Page ID\"", 69 | "fieldname": "page_id", 70 | "fieldtype": "Link", 71 | "in_list_view": 1, 72 | "in_standard_filter": 1, 73 | "label": "Page ID", 74 | "mandatory_depends_on": "eval:doc.based_on==\"Page ID\"", 75 | "options": "Page ID" 76 | }, 77 | { 78 | "fieldname": "column_break_blgv", 79 | "fieldtype": "Column Break" 80 | }, 81 | { 82 | "fieldname": "event_frequency", 83 | "fieldtype": "Select", 84 | "label": "Event Frequency", 85 | "options": "All\nHourly\nDaily\nWeekly\nMonthly" 86 | }, 87 | { 88 | "fieldname": "meta_forms_section", 89 | "fieldtype": "Section Break", 90 | "label": "Meta Forms" 91 | }, 92 | { 93 | "default": "1", 94 | "fieldname": "force_fetch", 95 | "fieldtype": "Check", 96 | "label": "Force Fetch" 97 | }, 98 | { 99 | "description": "Uncheck Force Fetch to Remove form rows if you don't want to sync them.", 100 | "fieldname": "table_hsya", 101 | "fieldtype": "Table", 102 | "options": "Meta Forms" 103 | }, 104 | { 105 | "fieldname": "amended_from", 106 | "fieldtype": "Link", 107 | "label": "Amended From", 108 | "no_copy": 1, 109 | "options": "Sync New Add", 110 | "print_hide": 1, 111 | "read_only": 1, 112 | "search_index": 1 113 | }, 114 | { 115 | "fieldname": "column_break_rlez", 116 | "fieldtype": "Column Break" 117 | }, 118 | { 119 | "fieldname": "section_break_snbb", 120 | "fieldtype": "Section Break" 121 | }, 122 | { 123 | "description": "Lead Field Name\nYou Must set field name same as field name in Lead", 124 | "fieldname": "map_lead_fields", 125 | "fieldtype": "Table", 126 | "label": "Map Lead Fields", 127 | "options": "Map Lead Field" 128 | }, 129 | { 130 | "default": "0", 131 | "fieldname": "fetch_map_lead_fields", 132 | "fieldtype": "Check", 133 | "label": "Fetch Map Lead Fields" 134 | }, 135 | { 136 | "default": "Lead", 137 | "fieldname": "lead_doctype_name", 138 | "fieldtype": "Select", 139 | "in_list_view": 1, 140 | "in_standard_filter": 1, 141 | "label": "Lead Doctype Name", 142 | "options": "Lead\nCRM Lead" 143 | } 144 | ], 145 | "index_web_pages_for_search": 1, 146 | "is_submittable": 1, 147 | "links": [], 148 | "modified": "2025-03-11 22:34:48.117485", 149 | "modified_by": "Administrator", 150 | "module": "Mansico Meta Integration", 151 | "name": "Sync New Add", 152 | "naming_rule": "By \"Naming Series\" field", 153 | "owner": "Administrator", 154 | "permissions": [ 155 | { 156 | "create": 1, 157 | "delete": 1, 158 | "email": 1, 159 | "export": 1, 160 | "print": 1, 161 | "read": 1, 162 | "report": 1, 163 | "role": "System Manager", 164 | "share": 1, 165 | "write": 1 166 | } 167 | ], 168 | "sort_field": "modified", 169 | "sort_order": "DESC", 170 | "states": [] 171 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mansico Meta Integration 2 | 3 |