When working with the WhatsApp Business API, encountering an error like 100: Invalid Parameter can disrupt your progress. This error typically occurs due to issues with the parameters sent in the API request. Let’s break down the causes and look at actionable solutions.

What Causes the "Invalid Parameter" Error?

This error arises when:

  1. You’ve included parameters that are either not supported by the API endpoint or contain spelling mistakes.

  2. When setting up the business public key, it doesn’t meet the required format: a valid 2048-bit RSA public key in PEM format.

  3. The phone_number_id in your request does not match the one previously registered.

  4. One or more parameters exceed the maximum allowed length for their type.

How to Resolve the Error?

1. Verify API Parameters

  • Cross-check the parameters in your request with the official endpoint references. Ensure every parameter is correctly spelled and supported for the endpoint you’re using.

  • Tip: Pay attention to case sensitivity, as the API differentiates between uppercase and lowercase characters.

2. Validate the RSA Public Key

Ensure your business public key meets the following criteria:

  • It is 2048 bits.

  • It is in PEM format.

To Generate/Reuse a 2048-bit RSA Key Pair

  • 1. Generate a private RSA key pair (encrypted with a password) using the following command:
    openssl genrsa -des3 -out private.pem 2048

  • 2. Export the RSA public key to a file:
    openssl rsa -in private.pem -outform PEM -pubout -out public.pem

  • 3. To extract and reuse an existing public key from an existing certificate use the following command:

openssl x509 -pubkey -noout -in private.pem > public.pem

3. Check the Phone Number ID

Confirm the phone_number_id you’re sending matches the ID previously registered in your WhatsApp Business Account.

4. Review Length Restrictions

Refer to the API documentation for length constraints on parameters (e.g., character limits for text fields).

For more insights on best practices related to WhatsApp Business API, check out our other blogs at heltar.com/blogs.