Panne partielleshare-external
Whatsapp business api, returns '(#100) The parameter name is required.', when trying to create template
1

I'm trying to create a message template for whatsapp business and i keep getting an error. Following the docs, I think my implementation is correct. If buttons are not included(with dynamic content its pretty much easy on the meta dashboard, but here I'm try to use button with dynamic content which is not possible on the dashboard so I have to go the curl way but it's not working. below is my implementation(had to switch to python thinking i might get on to something)

import requests
from requests.structures import CaseInsensitiveDict

url = "https://graph.facebook.com/v20.0/whatsapp_busines_id/message_templates"

headers = CaseInsensitiveDict()
headers["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"
headers["Content-Type"] = "application/json"

data = """
{
        "name": "payment_success_property_contact",
        "language": "en",
        "category": "UTILITY",
        "components": [
          {
            "type": "HEADER",
            "format": "TEXT",
            "text": "Payment Successful"
          },
          {
            "type": "BODY",
            "text": "Hi there! Great news! Your payment for \"{{1}}\" is successful. Please contact the owner via WhatsApp or normal call to visit and check the property. After your visit, you can confirm or cancel the payment.\n\nEnjoy your visit!",
            "example": {
              "body_text": [
                "Seaside Villa"
              ]
            }
          },
          {
            "type": "FOOTER",
            "text": "Nanohunt Software"
          },
          {
            "type": "BUTTONS",
            "buttons": [
              {
                "type": "URL",
                "text": "Contact via WhatsApp",
                "url": "https://wa.me/{{2}}",
                "example": {
                  "parameters": [
                    {
                      "type": "text",
                      "text": "YOUR_PHONE_NUMBER"
                    }
                  ]
                }
              },
              {
                "type": "PHONE_NUMBER",
                "text": "Call Owner",
                "phone_number": "{{2}}",
                "example": {
                  "parameters": [
                    {
                      "type": "text",
                      "text": "YOUR_PHONE_NUMBER"
                    }
                  ]
                }
              },
              {
                "type": "URL",
                "text": "Confirm or Cancel Payment",
                "url": "{{3}}",
                "example": {
                  "parameters": [
                    {
                      "type": "text",
                      "text": "https://yourwebsite.com/transaction/TRANSACTION_ID"
                    }
                  ]
                }
              }
            ]
          }
        ]
      }
"""

resp = requests.post(url, headers=headers, json=data)

print(resp.json())

So after running it i get

mbishu@fedora:~/Desktop/nanohuntapi$ python template.py
{'error': {'message': '(#100) The parameter name is required.', 'type': 'OAuthException', 'code': 100, 'fbtrace_id': 'AywCoC2brI1L5kRVmtbHD-c'}}

I search the internet so far but no viable solution

Mbishu
Posée il y a environ 2 mois
Naresh

Did you found any resolution for the above issue. I am also running into the same error

8 octobre, 17:34