{"id":27433138,"url":"https://github.com/techmedaddy/zeotap-salesforce-integration","last_synced_at":"2026-04-10T04:49:24.634Z","repository":{"id":287354705,"uuid":"964453036","full_name":"techmedaddy/zeotap-salesforce-Integration","owner":"techmedaddy","description":"Simulated integration between Zeotap and Salesforce Service Cloud using Node.js. Demonstrates contact sync, API design, and OAuth 2.0 flow understanding.","archived":false,"fork":false,"pushed_at":"2025-04-11T11:52:22.000Z","size":1471,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T17:14:13.762Z","etag":null,"topics":["api","axios","dotenv","expressjs","jest","json","nodejs","oauth2","render","salesforceapi"],"latest_commit_sha":null,"homepage":"https://zeotap-salesforce-integration.onrender.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techmedaddy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-11T08:33:46.000Z","updated_at":"2025-04-11T11:52:25.000Z","dependencies_parsed_at":"2025-04-11T10:56:25.827Z","dependency_job_id":"dc6220e0-5fdd-4c43-a7c6-f6233e3580ad","html_url":"https://github.com/techmedaddy/zeotap-salesforce-Integration","commit_stats":null,"previous_names":["techmedaddy/zeotap-salesforce-integration"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techmedaddy%2Fzeotap-salesforce-Integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techmedaddy%2Fzeotap-salesforce-Integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techmedaddy%2Fzeotap-salesforce-Integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techmedaddy%2Fzeotap-salesforce-Integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techmedaddy","download_url":"https://codeload.github.com/techmedaddy/zeotap-salesforce-Integration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248923767,"owners_count":21183953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","axios","dotenv","expressjs","jest","json","nodejs","oauth2","render","salesforceapi"],"created_at":"2025-04-14T17:14:16.675Z","updated_at":"2025-12-30T20:20:50.673Z","avatar_url":"https://github.com/techmedaddy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zeotap ↔ Salesforce Contact Integration (Simulation)\r\n\r\nThis project simulates an integration between **Zeotap** and **Salesforce Service Cloud**, specifically focusing on the **Contact** object. Built using **Node.js** and **Express**, it demonstrates how to sync customer contact data using Salesforce APIs.\r\n\r\n---\r\n\r\n## 📌 Use Case and Goals\r\n\r\nThe purpose of this integration is to **sync customer profile data from Zeotap to Salesforce**, ensuring that contact records in Salesforce are always up-to-date. This helps sales and support teams access the latest customer information.\r\n\r\n---\r\n\r\n\r\n## 🧩 System Design\r\n\r\n![WhatsApp Image 2025-04-11 at 14 26 06_f3a29a02](https://github.com/user-attachments/assets/1b3de590-f7d7-4608-a971-92cb954aa88e)\r\n\r\n\r\n## 🔁 Data Flow Overview\r\n\r\n1. A user’s contact information is updated in Zeotap.\r\n2. Zeotap triggers an API call to our backend service.\r\n3. The backend service authenticates with Salesforce.\r\n4. It then creates or updates the Contact object in Salesforce via its REST API.\r\n\r\n---\r\n\r\n## 🔐 Authentication Method\r\n\r\nThis integration uses **OAuth 2.0 (Resource Owner Password Credentials Grant)** to authenticate with Salesforce.\r\n\r\n### Steps to obtain access token:\r\n1. Make a `POST` request to:  \r\n   `https://login.salesforce.com/services/oauth2/token`\r\n2. Include the following params in `x-www-form-urlencoded`:\r\n   - `grant_type=password`\r\n   - `client_id`\r\n   - `client_secret`\r\n   - `username`\r\n   - `password`\r\n3. Salesforce returns an `access_token` and `instance_url`, used in subsequent API calls.\r\n\r\n---\r\n\r\n## 📌 Key Salesforce Endpoints\r\n\r\n| Action   | Method | Endpoint |\r\n|----------|--------|----------|\r\n| Create Contact | `POST` | `/services/data/vXX.X/sobjects/Contact/` |\r\n| Update Contact | `PATCH` | `/services/data/vXX.X/sobjects/Contact/{ContactId}` |\r\n| Get Token | `POST` | `https://login.salesforce.com/services/oauth2/token` |\r\n\r\n\u003e Replace `vXX.X` with your Salesforce API version (e.g., `v59.0`)\r\n\r\n---\r\n\r\n## 📥 Sample Requests and Responses\r\n\r\n### ✅ Create Contact - Request (from Zeotap)\r\n\r\n```json\r\n{\r\n  \"FirstName\": \"Amit\",\r\n  \"LastName\": \"Sharma\",\r\n  \"Email\": \"amit.sharma@example.com\",\r\n  \"Phone\": \"+919999888877\"\r\n}\r\n```\r\n\r\n### ✅ Create Contact - Simulated Salesforce Response\r\n\r\n```json\r\n{\r\n  \"id\": \"0035g00001QWdA2AAL\",\r\n  \"success\": true,\r\n  \"errors\": []\r\n}\r\n```\r\n\r\n### ✏️ Update Contact - Request\r\n\r\n```json\r\n{\r\n  \"id\": \"0035g00001QWdA2AAL\",\r\n  \"Phone\": \"+917777666555\",\r\n  \"MailingCity\": \"Mumbai\"\r\n}\r\n```\r\n\r\n\r\n### ✏️ Update Contact - Simulated Salesforce Response\r\n\r\n```json\r\n{\r\n  \"status\": 204,\r\n  \"message\": \"No Content - Contact successfully updated.\"\r\n}\r\n```\r\n\r\n## ⚠️ Common Errors, Rate Limits, and Required Fields\r\n\r\n### 🔧 Required Fields\r\n- `LastName` is mandatory when creating a contact.\r\n\r\n### ❌ Common API Errors\r\n- `400 Bad Request` – Missing required fields.\r\n- `401 Unauthorized` – Invalid token or expired session.\r\n- `404 Not Found` – Wrong contact ID for update.\r\n\r\n### 🚦 Rate Limits (per Salesforce documentation)\r\n- 100 API calls per user per 24-hour rolling window (free developer edition).\r\n- Bulk limits apply for large operations.\r\n\r\n\r\n## 🧪 Testing (Jest)\r\n\r\nBasic unit tests included under `__tests__/salesforceService.test.js` using Jest.\r\n\r\nRun with:\r\n```bash\r\nnpm test\r\n```\r\n\r\n![WhatsApp Image 2025-04-11 at 15 58 31_51584986](https://github.com/user-attachments/assets/1fc180e9-171e-42dc-ba13-9d599c9dadfb)\r\n\r\n\r\n## 📎 Assumptions and Edge Cases\r\n\r\n- A contact is assumed to exist in Salesforce if an `id` is provided.\r\n- If no `id` is provided, a new contact is created.\r\n- This simulation assumes perfect data; in a real-world scenario, duplicate detection logic would be needed.\r\n- No retry logic for failed API calls is implemented in this simulation.\r\n\r\n## 🛠️ Tech Stack\r\n\r\n- **Backend**: Node.js, Express  \r\n- **HTTP Client**: Axios  \r\n- **Environment Config**: dotenv  \r\n- **Mock Data**: JSON payloads  \r\n- **Deployment**: Render\r\n\r\n## ▶️ How to Run Locally\r\n\r\n### 1. Clone the repo:\r\n```bash\r\ngit clone https://github.com/your-username/zeotap-salesforce-integration.git\r\ncd zeotap-salesforce-integration\r\n```\r\n\r\n### 2. Install dependencies:\r\n```bash\r\nnpm install\r\n```\r\n\r\n### 3. Create a `.env` file:\r\n```env\r\nPORT=48753\r\nCLIENT_ID=dummy-client-id\r\nCLIENT_SECRET=dummy-client-secret\r\nUSERNAME=dummy-user@example.com\r\nPASSWORD=dummy-password123\r\nSALESFORCE_BASE_URL=https://dummy-instance.salesforce.com\r\n```\r\n### 4. Start the server:\r\n```bash\r\nnpm run dev\r\n```\r\n\r\n## 📫 API Endpoint\r\n\r\n**POST** `/api/sync-contact`  \r\nHandles both contact creation and update depending on presence of `id`.\r\n\r\n\r\n\r\n## 📌 Deployment (Render)\r\n\r\n1. Push project to GitHub.\r\n2. Connect repo to [Render.com](https://render.com).\r\n3. Set the following environment variables:\r\n   - `PORT`, `CLIENT_ID`, `CLIENT_SECRET`, `USERNAME`, `PASSWORD`, `SALESFORCE_BASE_URL`\r\n4. Build command: `npm install`  \r\n   Start command: `npm start`\r\n5. Click **“Deploy Web Service”**.\r\n\r\n## 📂 Folder Structure\r\n\r\n```bash\r\nzeotap-salesforce-integration/\r\n├── app.js\r\n├── .env\r\n├── .gitignore\r\n├── package.json\r\n├── README.md\r\n├── routes/\r\n│   └── contact.js\r\n├── controllers/\r\n│   └── contactController.js\r\n├── services/\r\n│   └── salesforceService.js\r\n├── sample/\r\n│   └── payloads.js\r\n```\r\n---\r\n\r\n\u003e 📝 **Note**: This project is a simulation and does not connect to a live Salesforce instance. It is designed to demonstrate API integration structure, flow, and logic for assessment purposes.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechmedaddy%2Fzeotap-salesforce-integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechmedaddy%2Fzeotap-salesforce-integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechmedaddy%2Fzeotap-salesforce-integration/lists"}