Search code examples
facebookwhatsapp

How to check whether whatsapp message is successfully sent or not in WA Business API?


Im sending whatsapp message from whatsapp business api. API collections i got from facebook-whatsapp docs. Link

My End goal to check blue tick, does recipient has seen the message.


Solution

  • When you call the send message endpoint (POST /v1/messages), if it succeeds (201 created), you will receive a message ID on the return payload (e.g. 12345), like this:

    {
      "messages": [{ 
        "id": "12345" 
      }]    
    }
    

    After that, at some point in the future, whatsapp will asynchronously send notifications to the webhook server informing every status changes on that message (sent, delivered, read, failed and deleted). Those notifications will be referencing that same message ID informed before (e.g. 12345), like this:

    {
      "statuses": [{
        "id": "12345",
        "recipient_id": "553199999999",
        "status": "delivered",
        "timestamp": "1650509418",
        "type": "message",
        "conversation": {
          ...
        },
        "pricing": {
          ...
        }
      }]
    }
    

    (Check https://developers.facebook.com/docs/whatsapp/on-premises/webhooks/outbound for more details).

    So, if you need to ensure a message was read, you must capture that sent message ID and then observe all the status change notifications until you receive the proper read status for that very message, with that specific id.