Hi I want to use WhatsApp business API in my web application. I have tested it in postman.

Whenever run sample curl code when available in Facebook business page under WhatsApp tab, It run successfully with temporary access token and message delivered to recipient with Facebook saved template. But when I send only text message to recipient then API response become success with message Id but message not yet deliver to recipient.

My curl code sample given bellow

curl --location --request POST 'https://graph.facebook.com/v13.0/106433498743301/messages' \ --header 'Authorization: Bearer EAAOw8oNtvXkBAKk89CqJtyusjxk7c7qGSNS0quxqeZBRtjE5MYwZCK0USeGGLV4n56qNAuaRoRWZA2oCIS8zcz6U5UZAtQCOb6YQnjuXZBfLnyZAwsOZBpASpnNOvvz29T0Jn0aXgZAdo9VKmBv0CkNYuOeb1I7X0GZCEwLHPZBFpfOCj4K3S9CMPjBfYR5Jog06LC95P7UgCr5Fy2nqbRM5Ys' \ --header 'Content-Type: application/json' \ --data-raw '{ "messaging_product": "whatsapp", "preview_url": false, "recipient_type": "individual", "to": "xxxxxxx150", "type": "text", "text": { "body": "Test message" } }' 

Tag:php, curl, whatsapp, facebook-graph-api

10 comments.

  1. apositivo

    The official documentation indicates that in order to send such messages, the conversation must be initiated by the user. https://developers.facebook.com/docs/whatsapp/conversation-types

    1. igonzalez

      This should be accepted as right answer. I spent so many hours until I read this. Thanks.

    2. Elizandro - SparcBR

      Shouldn't an error response be returned? How do I know the message was not sent?

    3. apositivo

      hi @Elizandro-SparcBR, the error response, do you refer to show a message as it is? user-images.githubusercontent.com/89229582/…

  2. LeonS

    I had the same problem. After I have sent a message from my phone to the testnumber, it worked.

    regards

    Leon

    1. jacobytes

      I'm trying to do this, but the test number isn't showing up as a contact on WhatsApp after I added it. Regular text message to the number aren't being delivered. How did you manage to do this?

    2. Anfuca

      In my case, I had to accept the terms and conditions to be able to received messages. More info here: stackoverflow.com/a/74402256/2990234

    3. Volatil3

      @Anfuca when do you see the terms message? Does it come when you send a Hello message to a FB given test number starts with +1?

  3. Imran Yousuf

    Other than the template(approved from meta) message, the conversation must be started by the User. So Send a message first on your WhatsApp number and then you can conversate with the Recipient number.

    1. Nulik

      the problem with this method is that you have to initiate conversations every 24 hours. after 24 hours the configuration expires and you can no longer send messages. But if you are writing a notification service this is not useful because I don't want to send anything, I just need to receive

Add a new comment.