1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Sending whatsapp messages to a number using the API

Discussão em 'Angular' iniciado por Sam Daniel, Setembro 10, 2024.

  1. Sam Daniel

    Sam Daniel Guest

    I am trying to send a message to a WhatsApp number from my app built using Angular 4 and Ionic 3 . I am trying this on a button click event. This is my code.

    HTML

    <div padding>
    <button id="addBtn" (click)="WhatsApp()" ion-button color="primary" block>WhatsApp</button>
    </div>


    TS

    WhatsApp(){
    return new Promise(resolve => {
    console.log("Before API")
    this.http.get("https://api.whatsapp.com/send?phone=121234567891&text=I'm%20interested%20in%20your%20car%20for%20sale").map(response => response.json()).subscribe(data => {
    resolve(data);
    console.log("After API",data)
    }, err => {
    });
    });
    }


    I want to send a message on the button click. So where must I specify the number from which and number to which I am going to send and is the way I have done is correct? Thanks in advance

    Continue reading...

Compartilhe esta Página