# Ionic native share plugin not working for whatsapp

**URL:** <https://forum.ionicframework.com/t/ionic-native-share-plugin-not-working-for-whatsapp/102560>\
**Category:** Ionic Native\
**Created:** [August 19, 2017, 5:30pm UTC](https://forum.ionicframework.com/t/ionic-native-share-plugin-not-working-for-whatsapp/102560 "2017-08-19T17:30:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![yash05041999](https://avatars.discourse-cdn.com/v4/letter/y/46a35a/32.png) [@yash05041999](https://forum.ionicframework.com/u/yash05041999)\
**Post date:** [August 19, 2017, 5:30pm UTC](https://forum.ionicframework.com/t/ionic-native-share-plugin-not-working-for-whatsapp/102560/1 "2017-08-19T17:30:03Z")

</div>

**native share** plugin works for email but when I use the share via whatsapp function it doesn’t work…  
Can you suggest the code so that share plugin works for whatsapp as well.  
I used the code similar to that give in ionic docs…

---

<div class="post-metadata">

**Author:** ![zoha131](https://avatars.discourse-cdn.com/v4/letter/z/fbc32d/32.png) [@zoha131](https://forum.ionicframework.com/u/zoha131)\
**Post date:** [August 19, 2017, 6:43pm UTC](https://forum.ionicframework.com/t/ionic-native-share-plugin-not-working-for-whatsapp/102560/2 "2017-08-19T18:43:23Z")

</div>

I have used [Social Sharing](https://ionicframework.com/docs/native/social-sharing/) .  
First you have to inject the plugin.

```auto
constructor(private socialSharing: SocialSharing) { }

```

then you have to call the **shareViaWhatsApp(message, image, url)** function like this:

```auto
whatsappShare(){
    this.socialSharing.shareViaWhatsApp("Your Message", "image" , "link")
      .then(()=>{
        console.log("WhatsApp share successful");
      }).catch((err)=> {
      console.log("An error occurred ", err);
    });
  }

```

then you can call **whatsappShare( )** to share.

---

<div class="post-metadata">

**Author:** ![danielle123](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@danielle123](https://forum.ionicframework.com/u/danielle123)\
**Post date:** [August 19, 2017, 7:13pm UTC](https://forum.ionicframework.com/t/ionic-native-share-plugin-not-working-for-whatsapp/102560/3 "2017-08-19T19:13:59Z")

</div>

you better share the code.  
I confirm that share plugin works well in my app.

---

<div class="post-metadata">

**Author:** ![yash05041999](https://avatars.discourse-cdn.com/v4/letter/y/46a35a/32.png) [@yash05041999](https://forum.ionicframework.com/u/yash05041999)\
**Post date:** [August 23, 2017, 5:19pm UTC](https://forum.ionicframework.com/t/ionic-native-share-plugin-not-working-for-whatsapp/102560/5 "2017-08-23T17:19:14Z")

</div>

![shareplugin](https://global.discourse-cdn.com/ionicframework/original/3X/1/0/10e34fc02c02a1ad719563e0daf1c818eadefe24.png)  
Here is the snippet of the code I used to impliment socialshare plugin.  
Can you please help me figuring out where I went wrong.

PS: I repeat Email and twitter are working the plugin is not working for whatsapp and other social media

---

<div class="post-metadata">

**Author:** ![soundboard6](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/soundboard6/32/107506_2.png) [@soundboard6](https://forum.ionicframework.com/u/soundboard6)\
**Post date:** [November 16, 2017, 6:11pm UTC](https://forum.ionicframework.com/t/ionic-native-share-plugin-not-working-for-whatsapp/102560/6 "2017-11-16T18:11:42Z")

</div>

### WHATSAPP IOS9 QUIRK

"If you want to use ‘shareViaWhatsApp’ on iOS9 you need to whitelist the url scheme of whatsapp and test for the app’s availability with `canShareVia()`"

```auto
window.plugins.socialsharing.canShareVia('whatsapp', 'Hi', file, url, [success], [error]);

```

Source: [https://plugins.telerik.com/cordova/plugin/socialsharing](https://plugins.telerik.com/cordova/plugin/socialsharing)

---

<div class="post-metadata">

**Author:** ![vibinflogesoft](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/vibinflogesoft/32/117525_2.png) [@vibinflogesoft](https://forum.ionicframework.com/u/vibinflogesoft)\
**Post date:** [January 23, 2018, 12:43pm UTC](https://forum.ionicframework.com/t/ionic-native-share-plugin-not-working-for-whatsapp/102560/7 "2018-01-23T12:43:05Z")

</div>

Hi@yash05041999  
i have the same issue.using share via whats app function.  
but  
this.socialSharing.shareViaWhatsApp(‘message’,null,null)  
helps to send message,while adding the url and image it shows “sharing failed please try again”

---

<div class="post-metadata">

**Author:** ![BayBoran](https://avatars.discourse-cdn.com/v4/letter/b/8e7dd6/32.png) [@BayBoran](https://forum.ionicframework.com/u/BayBoran)\
**Post date:** [January 30, 2018, 8:38am UTC](https://forum.ionicframework.com/t/ionic-native-share-plugin-not-working-for-whatsapp/102560/8 "2018-01-30T08:38:08Z")

</div>

same here;

```auto
cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.6
    Cordova Platforms : ios 4.5.4
    Ionic Framework : ionic-angular 3.9.2

System:

    ios-deploy : 1.9.2
    ios-sim : 6.1.2
    Node : v6.9.5
    npm : 5.3.0
    OS : macOS High Sierra
    Xcode : Xcode 9.2 Build version 9C40b

```

and here is my sharing code

```auto
this.share.shareViaWhatsApp(‘message’,’image url’,’shared url').then( () => {
                            
                            const toast = this.toastCtrl.create({
                                message: ’Shared its ok...',
                                position: 'middle',
                                duration: 2000,
                                closeButtonText:’Close',
                                cssClass:'toastcss'
                              });
                          
                              toast.present();
                        }).catch(()=>{
                            const toast = this.toastCtrl.create({
                                message: ’There is an error',
                                position: 'middle',
                                duration: 2000,
                                closeButtonText:’Close',
                                cssClass:'toastcsserror'
                              });
                          
                              toast.present();
                        });

```

when i test it it shares only images. there is no message and no url.

---

<div class="post-metadata">

**Author:** ![zubquzaini](https://avatars.discourse-cdn.com/v4/letter/z/45deac/32.png) [@zubquzaini](https://forum.ionicframework.com/u/zubquzaini)\
**Post date:** [April 27, 2018, 3:04pm UTC](https://forum.ionicframework.com/t/ionic-native-share-plugin-not-working-for-whatsapp/102560/9 "2018-04-27T15:04:22Z")

</div>

I am facing the same issue, no url

---

<div class="post-metadata">

**Author:** ![ajay4u](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@ajay4u](https://forum.ionicframework.com/u/ajay4u)\
**Post date:** [March 18, 2020, 10:56am UTC](https://forum.ionicframework.com/t/ionic-native-share-plugin-not-working-for-whatsapp/102560/10 "2020-03-18T10:56:23Z")

</div>

Please help. Stuck with same problem. Unable to send dataURI image nor file

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:01pm UTC](https://forum.ionicframework.com/t/ionic-native-share-plugin-not-working-for-whatsapp/102560/11 "2021-07-19T21:01:25Z")

</div>


