Get the ABid of a 'Contacts Framework' contact

4

I'm trying to open a Whatsapp conversation from my app. I have imported my contacts in core data, I have looked at the info that gives Whatsapp on their website and it is necessary to add the ABid of the contact in the URL scheme.

I've been looking at the Contacts documentation on the Apple Developer page and CNContact has a constant call CNContactIdentifierKey but it returns a string like this: 86BA6C28-74E5-4A32-A270-5D18C2DFCD3B .

Any kind of help is welcome and grateful.

    
asked by jescabias 15.12.2015 в 23:12
source

2 answers

1

Try passing that CNContactIdentifierKey with this URL:

NSURL *URL = [NSURL URLWithString:@"whatsapp://send?abid=IDENTIFIER&text=Muak!"];

In theory when opening this URL with:

[[UIApplication sharedApplication] openURL:URL];

You should start a conversation with the corresponding contact in the contact list by defaulting the text.

    
answered by 16.12.2015 в 08:25
0

The scheme of URL and parámetro of text can be easily integrated with applications such as Pro Launch Center and Drafts. In the Pro Launch Center, create an action that allows you to write a message on the keyboard, launching WhatsApp with your text already there:

NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=Hello%2C%

Read more information here link

    
answered by 16.12.2015 в 01:07