1

In my application,I added those contact who has whatsapp installed on their devices.

From my application i can send message to any one of those contacts one by one.

I have used this link Whatsapp API

NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=Hello%2C%20World!"];                                                             
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
[[UIApplication sharedApplication] openURL: whatsappURL];
}

Now i create a group User1,User2 . And i want to send them message through whatsapp by one button click.Is this possible?

user3244721
  • 714
  • 2
  • 11
  • 29
  • 2
    please check : http://ioscoderhub.wordpress.com/2014/05/01/how-can-i-share-image-from-iphone-application-to-whatsapp-line-wechat-programmatically/ – Nitin Gohel Jun 25 '14 at 06:42
  • The issue is "I want to send to multiple users by one click"...here you have to send to one then again send to other... – user3244721 Jun 25 '14 at 06:45
  • that facility also not provide by whatsapp to then how could you sent one text to multiple user at a time you either select one user or group at a time. – Nitin Gohel Jun 25 '14 at 06:47
  • I want to select user or group from my own contact list in my app....same as whatsapp group i will have my own group... – user3244721 Jun 25 '14 at 06:55

1 Answers1

0

I don't think you can directly do it, you can either send the user to a contact or a group selection screen as said by @Nitin Gohel. For sending a text to a particular contact you would probably do this,

NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=Hello%2C%20World!&abid=143rnjk4545352523"];                                                             
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
[[UIApplication sharedApplication] openURL: whatsappURL];
}

abid is the address book id of the contact you would like to send a text, but for a group you don't have any such thing that is visible from the outside of whatsapp's sandbox.

So I guess, it is not possible to do it.

Just a wild guess about sending a message to multiple contacts,

P.S: I don't know whether this would work or there is not official documentation to support this. Try abid's with commas.

NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=Hello%2C%20World!&abid=143rnjk4545352523,32545365436d34,3f4fret454f,f4w454etgegdt"];                                                             
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
[[UIApplication sharedApplication] openURL: whatsappURL];
}

Also I came across this, which I think says us this is not quite possible with the existing whatsapp url scheme support.

Satheesh
  • 10,998
  • 6
  • 50
  • 93
  • I want to add mobile contacts to my own group.This group will be in my own app.Then if i select a group,I want to send message to all its members through whatsapp...As whatsapp allow to send to single user,can i loop all those users? – user3244721 Jun 25 '14 at 06:57
  • @user3244721 I don't know if this is the right way and also there is no docs to prove this, so trial and error is the only way so try the above edit and let me know. – Satheesh Jun 25 '14 at 07:01
  • Can you please check the other answer,that class has option to send to individual abid..so what if we create loop? – user3244721 Jun 25 '14 at 07:12
  • @user3244721 Dude whatever that class does is pretty much similar to whatever you are doing and we are discussing here, there is no way to LOOP abids and even if you do so whatsapp's url scheme would not be able to handle it. We have to do a trial and error way of finding out a way to do it. – Satheesh Jun 25 '14 at 07:15