How to listen for events?

but you going to connect device/emulator to some PC anyway

Yes sure Android emulated device, but whats your point?

ok. at least now we have details. i suggest use 2 driver strategy. one driver opens web (no matter on computer or on some emulated device) and looking for messages. another driver does another job with another device/web (depending what exactly you need). i made test like a chat - when 2 apps open on different devices and one sending something, another one respond.

Hey Aleksel.

One automation test for each task sounds like a good idea. 1 for reading messages, 1 for sending messages.

I think browser automation for my case is not possible because on WhatsApp (web.whatsapp.com) you cannot add new contacts. And i want to automatically save phone numbers for all incoming messages containing a specific keyword

For example: A person sends “subscribe”

Now i want to have one Appium Test running in the background of my server doing this. It should permanently scan all incoming messages on the emulated device and add numbers to the contact list.

no test is ONE. in one test open first driver to device 1. and second driver to device 2. and start you steps with checks. but is all depends on your needs. maybe as you said background scan is fine for you.

I think you cannot run the same app with same SIM number on 2 devices at the same time.

hardly i can imagine your steps if you did not provide.

I think i know what to do now (at least in theory) i will try some things within the next days and let you know if i have further questions.

thanks for your kind help so far.