{"id":26678107,"url":"https://github.com/telexintegrations/sales-agent","last_synced_at":"2025-03-26T05:14:54.855Z","repository":{"id":281650242,"uuid":"945921812","full_name":"telexintegrations/sales-agent","owner":"telexintegrations","description":"A Sales Agent Integration for the Telex App. It is responsible for querying external APIs to find leads.","archived":false,"fork":false,"pushed_at":"2025-03-24T17:53:54.000Z","size":1344,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"dev","last_synced_at":"2025-03-24T18:47:10.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/telexintegrations.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-03-10T10:37:17.000Z","updated_at":"2025-03-24T11:21:47.000Z","dependencies_parsed_at":"2025-03-24T18:36:27.814Z","dependency_job_id":"db4a3845-d55f-4f8e-b7ba-602dde3ea898","html_url":"https://github.com/telexintegrations/sales-agent","commit_stats":null,"previous_names":["telexintegrations/sales-agent"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2Fsales-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2Fsales-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2Fsales-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2Fsales-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telexintegrations","download_url":"https://codeload.github.com/telexintegrations/sales-agent/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245591535,"owners_count":20640692,"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":[],"created_at":"2025-03-26T05:14:54.225Z","updated_at":"2025-03-26T05:14:54.820Z","avatar_url":"https://github.com/telexintegrations.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sales Agent AI\n\n## Overview\n\nSales Agent Integration introduces a cutting-edge solution for business owners to discover potential leads with ease. By specifying their business type and target audience through a simple chat with a sales agent, users receive a curated list of relevant leads in an organized format. This streamlined process enhances customer outreach and supports business growth.\n\n## Key Features\n\n- **Chat-Based Input**: Business owners can provide their business type and target audience through a friendly chat interface with the sales agent on the telex platform.\n- **Curated Lead Generation**: The sales agent retrieves a list of potential leads tailored to the specified criteria.\n- **Organized Output**: Leads are presented in a clear and easy-to-read format.\n- **Custom Automation**: The lead retrieval process runs automatically at a set time, ensuring business owners always have access to updated leads.\n- **Telex Success Notifications**: Users receive success messages via the Telex channel whenever new leads are fetched.\n\n\n## How It Works\n### Telex Setup and activating the Sales Agent\n#### Steps\n1. **Sign Up**: Sign up for a Telex account at [Telex](https://telex.im).\n2. **Create an Organisation**: Create an organisation on the Telex platform.\n   ![Step 1: Create Organisation](src/main/resources/static/telex-setup/1.png)\n3. **Create a Channel**: Create a channel in the organisation.\n   ![Step 2: Create Channel](src/main/resources/static/telex-setup/2.png)\n4. **Add the Sales Agent**: Click on `Apps`, then click on `Add New` to add the Sales Agent to the channel.\n![Step 3: Add Sales Agent Integration](src/main/resources/static/telex-setup/3.png)\n5. **Sales Agent Integration**: Enter this URL `https://sales-agent-3wyf.onrender.com/integration.json` in the `Integration Json Url` field and click `Save`.\n6. **Activate the Sales Agent**: Click on `the toggle button` to activate the Sales Agent in the channel.\n7. **Confugure the Sales Agent**: Click on the `Manage App` button to configure the Sales Agent.\n8. **Set the Custom Channel**: Click on the `Output` tab -\u003e Custom Channels -\u003e Add Custom Channel -\u003e Select the channel you want to see the output.\n![Step 4: Activate Sales Agent](src/main/resources/static/telex-setup/4.png)\n9. You're all set! The Sales Agent is now active in the channel.\n\n### Sales Agent Chat Interaction\n\nThe chat interaction between business owners and the sales agent takes place in the telex channel and is handled by the `ChatService` class  which processes messages, validates inputs, and guides users through a structured flow to collect information for lead generation. Below is a breakdown of the interaction steps:\n\n#### Interaction Flow\n\n1. **Starting the Process**:\n    - Users begin the process by sending the `/start` command.\n    - The system responds with a welcome message and prompts users to provide their business email address.\n\n       ![Step 1: Starting the Process](src/main/resources/static/sales-agent/1.png)\n\n2. **Exiting the Process**:\n    - At any point during the interaction, users can exit the process by sending the `/exit` command.\n    - The system acknowledges the exit request and stops the interaction.\n\n       ![Step 2: Exiting the Process](src/main/resources/static/sales-agent/6.png)\n\n3. **Email Validation**:\n    - The system validates the provided email address using a regex pattern.\n      ![Step 2: Accepted Email](src/main/resources/static/sales-agent/3.png)\n    - If the email is invalid or already exists in the system, an appropriate message is displayed.\n   \n      ![Step 3: Email Validation](src/main/resources/static/sales-agent/2.png)\n4. **Company Information**:\n    - Users are prompted to specify the company they are targeting by starting their response with `Company:` (e.g., `Company: linkedin`).\n    - Input is validated to ensure it follows the required format.\n\n      ![Step 3: Company Information](src/main/resources/static/sales-agent/4.png)\n\n5. **Lead Type**:\n    - Users specify the type of lead they need by providing the lead's domain name (e.g., `linkedin.com`).\n\n      ![Step 4: Lead Type](src/main/resources/static/sales-agent/5.png)\n\n6. **Automated Instructions**:\n    - Clear and friendly instructions are sent at every step of the process.\n    - The system communicates with users via the configured Telex webhook URL.\n\n7. **Persisting User Data**:\n    - Once all required inputs are collected, the user's information (email, company name, and lead type) is saved in the database for further processing.\n\n   \n8. **Domain Search Integration**:\n    - The service triggers the `domain-search` endpoint of the lead generation API to fetch leads matching the specified criteria.\n\n9. **Success Notification**: \n    - Upon successful lead retrieval, the system sends a notification to the user via the Telex channel with all the leads found.\n\n      ![Step 8: Leads Found](src/main/resources/static/sales-agent/new-lead-1.png)\n      ![Step 8: Leads Found](src/main/resources/static/sales-agent/new-lead-2.png)\n      ![Step 8: Leads Found](src/main/resources/static/sales-agent/new-lead-3.png)\n   ![Step 8: Leads Found](src/main/resources/static/sales-agent/new-lead-4.png)\n      ![Step 8: Leads Found](src/main/resources/static/sales-agent/new-lead-5.png)\n      ![Step 8: Leads Found](src/main/resources/static/sales-agent/new-lead-6.png)\n\n### Lead Search Integration\n\nThe lead search feature is implemented in the `domainSearch` method of the `LeadService` class. It retrieves potential leads based on the user's specified domain and stores new, unique leads in the database. Below is an overview of its workflow:\n\n#### Workflow\n\n1. **Retrieve User Details**:\n   - The `domainSearch` method starts by fetching the user's information from the database using the `channel_id` from the `SalesAgentPayloadDTO` payload.\n   - If the user is not found, an exception is thrown.\n\n2. **Construct API Request**:\n   - The method uses the domain provided by the user (`LeadType`) to construct the `domain-search` API request.\n   - The API key and base URL for the request are configured in `OkHttpConfig`.\n\n3. **Fetch and Parse Data**:\n   - A `GET` request is sent to the Hunter.io API\n   - The API response is parsed into a JSON object to extract relevant data, such as email addresses, names, LinkedIn URLs, company information, and industry.\n\n4. **Filter Unique Leads**:\n   - Existing leads in the database are checked to ensure no duplicates are stored.\n   - New leads are created only for entries with unique email addresses.\n\n5. **Save Leads and Notify**:\n   - New leads are saved to the database.\n   - For each new lead, the system sends a notification to the specified `Telex channel` using the `TelexClient`.\n\n6. **Log Success**:\n   - Logs are generated to confirm how many new leads were successfully saved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelexintegrations%2Fsales-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelexintegrations%2Fsales-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelexintegrations%2Fsales-agent/lists"}