shridarpatil / frappe_whatsapp

WhatsApp cloud integration for frappe
https://www.youtube.com/watch?v=nq5Kcc5e1oc
Other
188 stars 169 forks source link

language code is coming as null. #29

Closed Panchin99 closed 1 year ago

Panchin99 commented 1 year ago
Traceback with variables (most recent call last):
  File "apps/frappe/frappe/integrations/utils.py", line 21, in make_request
    frappe.flags.integration_request.raise_for_status()
      method = 'POST'
      url = 'https://graph.facebook.com/v16.0/108142048963233/messages'
      auth = ''
      headers = {'authorization': 'Bearer @@@@@@@@@@@@', 'content-type': 'application/json'}
      data = '{"messaging_product": "whatsapp", "to": "91@@@@@@", "type": "template", "template": {"name": "Testt", 
      "language": {"code": null},
      "components": [{"type": "body", "parameters": [{"type": "text", "text": "Helllooo"}]}]}}'
      s = <requests.sessions.Session object at 0x7fec0833c4c0>
      exc = HTTPError('400 Client Error: Bad Request for url: https://graph.facebook.com/v16.0/108142048963233/messages')
  File "env/lib/python3.10/site-packages/requests/models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
      self = <Response [400]>
      http_error_msg = '400 Client Error: Bad Request for url: https://graph.facebook.com/v16.0/108142048963233/messages'
      reason = 'Bad Request'
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://graph.facebook.com/v16.0/108142048963233/messages

Which can be fixed by customizing the doc. Currently, i got around by doing the follows: image

just add this "language.language_code" in fetch from image

shridarpatil commented 1 year ago

The language code with meta accepts and then one which frappe has are different frappe uses - and meta uses _ that's the reason we cannot use language code from frappe