Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open whatsapp chat for a number ionic 3/4

I have developed an app that should open a whatsapp chat using this plugin.

I installed it using ionic CLI ionic cordova plugin add https://github.com/ranjitpandit/whatsapp-phonegap-plugin.git and the used it as below:

home.page.ts

...

declare var cordova;

...
constructor(public platform: Platform) {}

chat() {

    this.platform.ready().then(() => {

      cordova.plugins.Whatsapp.send('+263783187321');

    });

}

Then in home.page.html I then did this:

<ion-row>
    <ion-col size="12" no-padding>
      <img src="assets/imgs/chat.jpg" (click)="chat()" class="chat" />
    </ion-col>
</ion-row>

The problem is that it's not opening a Whatsapp chat window when I click the image. Nothing happens. Please help. Thank you

like image 213
Ngoni X Avatar asked Feb 14 '19 11:02

Ngoni X


People also ask

How can I integrate WhatsApp with my number?

Use https://wa.me/<number> where the <number> is a full phone number in international format. Omit any brackets, dashes, plus signs, and leading zeros when adding the phone number in international format. Universal links can also include a pre-filled message that will automatically appear in the text field of a chat.


1 Answers

This is how it works in 2019 with Ionic 4

In config.xml add:

<access launch-external="yes" origin="whatsapp://*" />

In your html:

<a href="whatsapp://send?phone=YOUR_NUMBER">Link<a>
like image 147
Alejandro del Río Avatar answered Oct 04 '22 00:10

Alejandro del Río