Skip to main content

airbnb cleaning notification automation tool

Project description

aibnbclean

the following is some basic code that helps automate cleaning scheduling and communication for short-term rental properties such as Airbnb listings

  • it pulls booking data from airbnb calendars or google calendars
  • it uses google spreadsheets to track cleaning schedules and records
  • it uses google gemini api to parse airbnb user messages for additional info to store in the spreadsheet
  • it sends text message notifications to cleaners via twilio
  • it sends payment tasks to todoist

production install on raspberry pi

#install prequisite packages
sudo apt install chromium-browser
sudo apt install chromium-chromedriver

#install aibnbclean package
mkdir -p ~/Documents/production/aibnbclean
cd ~/Documents/production/aibnbclean
python -m venv .venv
. ./.venv/bin/activate
pip install aibnbclean

#setup config directory
mkdir -p ~/Documents/production/aibnbclean_config

listings.json example

create the following at ~/Documents/production/aibnbclean_config/listings.json

Each object describes a property and the integration points (calendar, spreadsheet, Todoist project, etc.).

[
  {
    "name": "Example Listing Name",
    "type": "airbnb",
    "laundry": "yes",
    "url": "https://example.com/calendar.ics",
    "spreadsheet_id": "<GOOGLE_SHEET_ID>",
    "spreadsheet_sheet_name": "Sheet1",
    "spreadsheet_sheet_id": 0,
    "spreadsheet_bitly_url": "http://bit.ly/example",
    "checklist_bitly_url": "",
    "default_cleaning_fee": 100,
    "qty_to_process": 10,
    "guests": { "min": 1, "max": 4 },
    "beds": { "min": 1, "max": 2 },
    "pnp_beds": { "min": 0, "max": 0 },
    "days_addrm_notice": 14,
    "todoist_project_name": "cleaning-tasks"
  },
  {
    "name": "Second Listing Name",
    "type": "home",
    "laundry": "no",
    "url": "https://calendar.google.com/second_calendar.ics",
    "spreadsheet_id": "<GOOGLE_SHEET_ID>",
    "spreadsheet_sheet_name": "Sheet1",
    "spreadsheet_sheet_id": 0,
    "spreadsheet_bitly_url": "http://bit.ly/secondexample",
    "checklist_bitly_url": "",
    "qty_to_process": 5,
    "default_cleaning_fee": 80,
    "guests": {},
    "beds": {},
    "pnp_beds": {},
    "days_addrm_notice": 7,
    "todoist_project_name": "home-cleaning-tasks"
  }
]

Field descriptions:

  • name (string): Human-readable listing name used in logs and UI.
  • type (string): Listing type; typically airbnb or home.
  • laundry (string): yes/no to indicate if cleaners should do laundry.
  • url (string): Calendar URL (iCal / .ics) or Google Calendar private feed used to fetch bookings.
  • spreadsheet_id (string): Google Sheets ID used for storing cleaning records and schedules.
  • spreadsheet_sheet_name (string): Name of the sheet/tab within the spreadsheet.
  • spreadsheet_sheet_id (number): Numeric sheet/tab ID (0-based or Google sheet gid depending on usage).
  • spreadsheet_bitly_url (string): Short URL to the spreadsheet for displaying in text messages.
  • checklist_bitly_url (string): Short URL to the cleaning checklist for displaying in text messages.
  • default_cleaning_fee (number): Default fee to use when calculating charges for a clean. Otherwise is home type is airbnb, the fee is pulled from the booking data.
  • qty_to_process (number): How many upcoming bookings to process at a time.
  • guests, beds, pnp_beds (objects): Optional min/max counts used for filtering or validations. Provide {} or omit if not applicable.
  • days_addrm_notice (number): numbers of days in the future to send notifications on dates added/removed. For example, if set to 14, notifications will be sent for bookings added/removed that are 14 days from the current date. A date added 30 days from now will not trigger a notification.
  • todoist_project_name (string): Name of the Todoist project where tasks should be created.

secrets configuration

create the following at aibnbclean_config/secrets.json

{
    "gemini_api_key": "api_key",
    "airbnb_userpass": "user_email:password",
    "todoist_api_key": "api_key",
    "twilio": {
        "client": "clientid:clientsecret",
        "from_number": "+18005551212",
        "to_number": "+18005562323"
    },
    "google_sa": {
        "type": "service_account",
        "project_id": "google-cloud-project-id",
        "private_key_id": "private_key_id",
        "private_key": "private_key_contents",
        "client_email": "client@project.iam.gserviceaccount.com",
        "client_id": "clientid",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://oauth2.googleapis.com/token",
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/client%40project.iam.gserviceaccount.com",
        "universe_domain": "googleapis.com"
    }
}

define a run.py at ~/Documents/production/run.py

import argparse
import os
import aibnbclean

if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Run aibnbclean with specific config directory"
    )

    parser.add_argument(
        "--config_dir",
        type=str,
        required=False,
        default=os.path.dirname(os.path.abspath(__file__)),
        help="Path to the configuration directory"
    )

    args = parser.parse_args()

    aibnbclean.process(
        config_dir=args.config_dir
    )

run daily using cron

the following example runs at 1:30pm daily

30 13 * * * date > /tmp/aibnbclean.log
30 13 * * * $HOME/Documents/production/aibnbclean/.venv/bin/python $HOME/Documents/production/run.py --config_dir $HOME/Documents/production/aibnbclean_config >> /tmp/aibnbclean.log 2>&1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aibnbclean-1.0.0.1.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aibnbclean-1.0.0.1-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file aibnbclean-1.0.0.1.tar.gz.

File metadata

  • Download URL: aibnbclean-1.0.0.1.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for aibnbclean-1.0.0.1.tar.gz
Algorithm Hash digest
SHA256 73ff86ccc96826b8e482e7e1eaf31d9805f9d70bdf90a06a4a29156477b1d58f
MD5 571882c67478d69938521f6737713b44
BLAKE2b-256 758dacc70b39f602c188ad1ae0e5c1cfb1f7c6cceaf5f5c9ab459946489425f3

See more details on using hashes here.

File details

Details for the file aibnbclean-1.0.0.1-py3-none-any.whl.

File metadata

  • Download URL: aibnbclean-1.0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for aibnbclean-1.0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dbeb5d733ede002d954c9883e9b19a09bbcf422d2afa1efc4b3eb569c9c73b4d
MD5 bce1503220f748016a4e3cfe16cdc03f
BLAKE2b-256 b2c36a04af468b8193564e1c9bee4a4347b7b7278a6d0a09282b3657e35125f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page