0

I have enabled receiving text messages from my iphone in Messages.app on my macbook. The problem I have, is that when my macbook is unlocked, any text messages I receive are displayed in macOS notifiactions (top right), and my iphone does vibrate or play a sound. Neither does my apple watch. If I unlock the screen on my iphone I can see the message. But if I leave the lid of the macbook open and go away, I will not receive any sound notification/vibration when a text message comes. And that's pretty bad for me.

Does anybody know a way to have the notifications both on macbook and iphone?

macOS: 10.15.4

iOS: 13.3.1

1

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()

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .