AI Agent for aggregated jobs notification in Slack

Suchismita Sahu
3 min readNov 25, 2024

--

Building an AI agent to aggregate job postings from various sources and send Slack notifications involves several components.

1. Define the Scope and Requirements

  • Objective: Automated slack notifications about job posting in various job hosting sites.
  • Input: Job Title
  • Output: A ranked list of different job openings in various job sites.
  • Key Features: Text parsing, keyword matching, semantic understanding, and explainability.
  • Data Sources:
  • Job boards (LinkedIn, Indeed, etc.).
  • Company career pages.
  • RSS feeds for job postings.

2. System Design

  • Job Aggregation: Scrapes job postings from sources like LinkedIn, Indeed, AngelList, and company careers pages.
  • AI Filtering: Uses AI to filter jobs based on relevance to an AI/ML Technical Product Owner role.
  • Slack Integration: Sends notifications with relevant job details to a Slack channel.
  • Custom UI: Provides a web-based interface for configuration (e.g., keywords, job sources, Slack channel).

3. Components

  1. AI Agent: Processes user preferences, aggregates jobs, and sends notifications.
  2. UI: Allows users to configure job preferences (e.g., keywords, locations) and connect their Slack workspace.
  3. Back-End Services:
  • Data scraping/aggregation.
  • Integration with Slack API.
  1. Database: Stores user preferences and job postings (optional for tracking history).

4. Implementation

Step 1: Input Preferences through UI

Create a simple UI for users to input:

  • Keywords: “AI/ML Product Owner, AI Product Manager”.
  • Locations: Remote, On-Site, Hybrid.
  • Sources: Select from LinkedIn, Indeed, company sites, etc.
  • Slack webhook URL: For notifications.

UI Requirements

  • A web form built using Flask or Django for backend and HTML/CSS/JS for the frontend.
<form method="POST" action="/submit">
<label for="keywords">Keywords:</label>
<input type="text" id="keywords" name="keywords" placeholder="e.g., AI/ML Product Owner" required>

<label for="locations">Preferred Locations:</label>
<input type="text" id="locations" name="locations" placeholder="e.g., Remote, New York">

<label for="sources">Job Sources:</label>
<select name="sources" id="sources" multiple>
<option value="linkedin">LinkedIn</option>
<option value="indeed">Indeed</option>
<option value="angellist">AngelList</option>
<option value="company_sites">Company Career Pages</option>
</select>

<label for="slack_webhook">Slack Webhook URL:</label>
<input type="url" id="slack_webhook" name="slack_webhook" required>

<button type="submit">Save</button>
</form>

Job Aggregation

Use APIs or web scraping tools like BeautifulSoup and Selenium to fetch job postings.

Sample Code for LinkedIn Jobs

import requests
from bs4 import BeautifulSoup

def scrape_linkedin_jobs(keywords, location):
search_url = f"https://www.linkedin.com/jobs/search?keywords={keywords}&location={location}&f_TPR=r86400"
headers = {"User-Agent": "Mozilla/5.0"}
response = requests.get(search_url, headers=headers)
soup = BeautifulSoup(response.text, 'html.parser')

jobs = []
for job_card in soup.find_all('div', class_='job-card-container'):
title = job_card.find('h3').text.strip()
company = job_card.find('h4').text.strip()
link = job_card.find('a', href=True)['href']
jobs.append({"title": title, "company": company, "link": f"https://www.linkedin.com{link}"})
return jobs

Filtering and Formatting

Use a keyword-matching or NLP-based filter for AIML-related terms.

Example Filtering Code

def filter_jobs(jobs, keywords):
filtered_jobs = []
for job in jobs:
if any(keyword.lower() in job['title'].lower() for keyword in keywords):
filtered_jobs.append(job)
return filtered_jobs

Sending Notifications to Slack

Use Slack Webhook or Slack SDK (slack_sdk).

Slack Integration Code

from slack_sdk import WebClient
# Send job postings to Slack
def send_to_slack(jobs, slack_channel, slack_token):
client = WebClient(token=slack_token)
for job in jobs:
message = f"*{job['title']}* at *{job['company']}*\nLocation: {job['location']}\n[Apply Here]({job['link']})"
client.chat_postMessage(channel=slack_channel, text=message)

Main Workflow

Combine all functions in a single workflow:

def main():
# Job criteria
keywords = ["AIML Technical Product Owner"]
location = "remote"
    # Scrape jobs
jobs = scrape_linkedin_jobs(keywords[0], location)
# Filter jobs
filtered_jobs = filter_jobs(jobs, keywords)
# Send to Slack
slack_token = "your-slack-bot-token"
slack_channel = "#job-alerts"
send_to_slack(filtered_jobs, slack_channel, slack_token)
if __name__ == "__main__":
main()

Web UI for Users

A simple Flask-based UI for managing job search criteria and viewing results.

Flask App Code

from flask import Flask, render_template, request
import threading
app = Flask(__name__)
@app.route("/")
def home():
return render_template("index.html")
@app.route("/set_criteria", methods=["POST"])
def set_criteria():
keywords = request.form['keywords']
location = request.form['location']
# Store criteria in a database or session
return "Criteria saved!"
@app.route("/start_agent")
def start_agent():
# Run the main agent workflow in a background thread
threading.Thread(target=main).start()
return "Agent started!"
if __name__ == "__main__":
app.run(debug=True)

Deployment

  1. Frontend: Host on Netlify or AWS S3 with CloudFront.
  2. Backend: Deploy Flask app on Heroku, AWS Elastic Beanstalk, or Dockerized on ECS.
  3. Scheduler: Use cron on a server or AWS Lambda with EventBridge for periodic tasks.

--

--

Suchismita Sahu
Suchismita Sahu

Written by Suchismita Sahu

Working as a Technical Product Manager at Jumio corporation, India. Passionate about Technology, Business and System Design.

No responses yet