Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.spn.wtf/llms.txt

Use this file to discover all available pages before exploring further.

Supported Lead Sources

SourceCode pathStorage source value
IndiaMART CRM APIlead_fetcher.py pollerindiamart
Facebook Lead Adslead_fetcher.py webhookfacebook_ads
Facebook Page messageslead_fetcher.py webhookfacebook_page
CSV uploadstreamlit_app.py dashboardfacebook
Manual SQLDirect insertAny configured value

IndiaMART

The poller calls:
https://mapi.indiamart.com/wservce/crm/crmListing/v2/
With:
INDIAMART_API_KEY=your_indiamart_api_key
INDIAMART_POLL_INTERVAL_MINUTES=15
INDIAMART_NEW_ONLY_MODE=true
When INDIAMART_NEW_ONLY_MODE=true, the code calls the API without explicit start/end timestamps after initialization, using IndiaMART’s new-lead cursor behavior. Stored fields:
  • phone from SENDER_MOBILE
  • name from SENDER_NAME
  • email from SENDER_EMAIL
  • product_name from QUERY_PRODUCT_NAME
  • city from SENDER_CITY
  • state from SENDER_STATE
  • query_message from QUERY_MESSAGE

Facebook Webhooks

Webhook endpoint:
GET  /webhook/facebook
POST /webhook/facebook
Configuration:
FACEBOOK_ACCESS_TOKEN=your_page_access_token
FACEBOOK_PAGE_ID=your_page_id
FACEBOOK_APP_SECRET=your_facebook_app_secret
FACEBOOK_VERIFY_TOKEN=your_verify_token
FACEBOOK_AD_FORM_IDS=form_id_1,form_id_2
WEBHOOK_PORT=8081
The GET endpoint handles Facebook verification. The POST endpoint handles events. If FACEBOOK_APP_SECRET is configured, the app verifies X-Hub-Signature-256.

Facebook Lead Ads

When Facebook sends a leadgen event, the app fetches the lead via Graph API and stores:
  • phone
  • name
  • email
  • source='facebook_ads'

Facebook Page Messages

For Page messages, the app attempts to fetch the sender phone number through Graph API. If no phone is available, it stores:
fb_psid_{sender_id}
The scheduler will not dial fb_psid_... values. It marks those leads failed because they do not contain a real phone number.

CSV Upload

The Streamlit dashboard supports CSV lead upload. Required columns:
  • name
  • phone
Optional columns:
  • source
  • email
  • product_name
  • city
  • state
  • query_message
CSV-uploaded rows are treated as Facebook-style leads by the dashboard’s _clean_source_value() function.