I wanted to integrate below functionality:
I am passing one contact number of a user. If that contact number already exists, directly opens that user's chat screen when I press on WhatsApp button in my app.
If that contact does not exist in the address book, then first, store this contact in the address book and then open that contact's chat screen in WhatsApp (with refreshing contacts so I will get the name of that person on WhatsApp chat screen).
I have done below task:
If contact does not exist, then it first stored in the address book and then move to WhatsApp. If I press the WhatsApp button again for the second time, then it checks that contact if it exists or not. If it's already saved, then fetch its record identifier and passed with WhatsApp URL scheme.
The main problem is that it just moves to WhatsApp's contact list, but does not open specific chat screen of the user.
Note: This thing works perfectly in Android, so I hope that it's also possible to integrate into iOS/Swift app.