Having text message notifications on my iphone (and apple watch), despite receiving notifications on macbook

Couldn't find anything, so I wrote a python script checks for new messages, and send me notifications via pushover. I turned it into an app and added it to login items, so i only get notifications this way when the macbook's lid is open. It's not clean, but it works.

import sqlite3
import pathlib
import time
import logging
import sys
import requests

logger = logging.getLogger('message-notifier')


def dict_factory(cursor, row):
    d = {}
    for idx, col in enumerate(cursor.description):
        d[col[0]] = row[idx]
    return d


conn = sqlite3.connect(str(pathlib.Path.home() / 'Library' / 'Messages' / 'chat.db'))
conn.row_factory = dict_factory
notified = set()
try:
    while True:
        logger.info('running')
        x = conn.execute("select is_read, ROWID from message "
                         "WHERE is_from_me = 0 "
                         "order by date desc limit 10;")
        for msg in x.fetchall():
            if not msg['is_read'] and msg['ROWID'] not in notified:
                logger.info(f'pushing notification for {msg["ROWID"]}')
                notified.add(msg['ROWID'])
                try:
                    requests.post('https://api.pushover.net/1/messages.json',
                                  data={
                                      "token": "token",
                                      "user": "user",
                                      "message": "msg",
                                      "title": "tit"
                                  })
                except:
                    logger.exception('encountered:')
                continue
            if msg['is_read'] and msg['ROWID'] in notified:
                logger.info(f"removing {msg['ROWID']} from notified msgs")
                notified.remove(msg['ROWID'])
                continue
        time.sleep(5)

finally:
    conn.close()