Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whatsapp API (#132000) Number of parameters does not match the expected number of params

I created below template in Whatsapp API. And I want to set the parameter value in the API call. What is the correct payload ? I have been following the Meta docs and trying but every time I get error. Please Help.

Template:

You order # {{1}} is received successfully.

enter image description here

I used this payload:

{
"messaging_product": "whatsapp", 
"to": "918456712349", 
"type": "template", 
"template": { 
    "name": "order_notification",
    "language": { 
        "code": "en_US" 
    }
},
"components": [
    {
        "type": "body",
        "parameters": [
            {
                "type": "text",
                "text": "135345345"
            }
        ]
    }
]
}

But I am still getting this error

{
"error": {
    "message": "(#132000) Number of parameters does not match the expected number of params",
    "type": "OAuthException",
    "code": 132000,
    "error_data": {
        "messaging_product": "whatsapp",
        "details": "body: number of localizable_params (0) does not match the expected number of params (1)"
    },
    "error_subcode": 2494002,
    "fbtrace_id": "AzPa-uWXctIcdNVu0Lf3Fic"
    }
}
like image 585
Kaushik Kumar Roy Avatar asked Jan 22 '26 20:01

Kaushik Kumar Roy


2 Answers

The issue due to closing the template object then opening a new component object. make the component object inside the template object and it will be fixed

{
"messaging_product": "whatsapp", 
"to": "918456712349", 
"type": "template", 
"template": { 
    "name": "order_notification",
    "language": { 
        "code": "en_US" 
    }

"components": [
    {
        "type": "body",
        "parameters": [
            {
                "type": "text",
                "text": "135345345"
            }
        ]
    }
]
}
}
like image 193
Hisham A Avatar answered Jan 25 '26 13:01

Hisham A


I just want to add to the right answer of Hisham A, that if you have more than one param/variable as I did you just have to add as many elements to the component as params.

In my case (sorry text being in portuguese):

For the mensage body:

Reserva de {{1}} para o(s) dia(s) {{2}} de {{3}} para a carrinha {{4}}.

The json data:

{ 
"messaging_product": "whatsapp",
 "to": "351934566644",
 "type": "template",
 "template": { 
    "name": "reserva_feita_teste",
    "language": { "code": "pt_PT" }, 
  
    "components": [
      {
          "type": "body",
          "parameters": [
              {
                  "type": "text",
                  "text": "Sofia"
              },
              {
                  "type": "text",
                  "text": "1, 2, 3"
              },
              {
                  "type": "text",
                  "text": "janeiro"
              },
              {
                  "type": "text",
                  "text": "Grande Nova"
              }
          ]
      }
    ]
 } 

}

like image 31
Duarte Almeida Avatar answered Jan 25 '26 12:01

Duarte Almeida