@dawnlike
history-service is the code that store and retrieve SMS.
But notifications of new SMS is managed by telephony-service.
Communication between them is handled through dbus with a middleware called Telepathy.
So you might listen to dbus signals if you want to be notified of a new sms.
If it helps:
https://m.youtube.com/watch?v=5b3PGvDbcp8
https://m.youtube.com/watch?v=IGgbEhTrmvg