1
votes

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.

2
How are you doing this? Using a WhatsApp Custom URL scheme? What does your current URL scheme look like and what do you expect it to do?William GP
as normal whatsapp url scheme which we call for moving in whatsapp app. But i seen that its work in android and also possible in swift/ios also using recordid.Pavan Gandhi

2 Answers

0
votes

Check out whats app Custom URL Scheme

https://www.whatsapp.com/faq/en/iphone/23559013

There is no URL Scheme registered for specific chat screen of user.

0
votes

Simply Append with ABID with your whatsapp url scheme and call this its worked.

ABID stands for the Address book Record ID,the code below works to get the AB Record ID. It is sensitive to the use of delimeters in the URL itself.

To send a note to a specific user use this - urlstring format: whatsapp://send?abid=12&text=Hello%20World - note the use of & to mark the second parameter.

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController    *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{   
    ARecordID  = (ABRecordID)ABRecordGetRecordID(person);
    ....
    whatsapp_string = [NSString stringWithFormat:@"whatsapp://send?abid=%d&text=%@;",ARecordID, "hello"];
    ....
}