Skip to content

How to use signature validation #13

@Cyberg01

Description

@Cyberg01

So i've been trying to validate several payload by following the code below.

https://github.com/fbsamples/whatsapp-api-examples/blob/main/signature-validation-with-webhooks-payloads/app.py

But the signature always different with the one in x-hub-signature-256 and ending up with "INVALID SIGNATURE HASH". Fyi i am using my app-secret as Token in that code.

example of payload that i am trying to validate :

{
    "object": "whatsapp_business_account",
    "entry": [
      {
        "id": "1xxxxxxx",
        "changes": [
          {
            "value": {
              "messaging_product": "whatsapp",
              "metadata": {
                "display_phone_number": "62xxxxxx",
                "phone_number_id": "1xxxxxx"
              },
              "contacts": [
                {
                  "profile": {
                    "name": "Somebody"
                  },
                  "wa_id": "62xxxxxx"
                }
              ],
              "messages": [
                {
                  "from": "62xxxxxx",
                  "id": "wamid.example",
                  "timestamp": "1740476674",
                  "text": {
                    "body": "halo"
                  },
                  "type": "text"
                }
              ]
            },
            "field": "messages"
          }
        ]
      }
    ]
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions