Error in frappe whatsapp

### App Versions
{
	"frappe": "15.35.0",
	"frappe_whatsapp": "v1.0.7",
}

### Route
Form/WhatsApp Templates/new-whatsapp-templates-faiixjcipg

### Traceback
Traceback (most recent call last):
  File "apps/frappe_whatsapp/frappe_whatsapp/frappe_whatsapp/doctype/whatsapp_templates/whatsapp_templates.py", line 105, in after_insert
    response = make_post_request(
               ^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/integrations/utils.py", line 43, in make_post_request
    return make_request("POST", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/integrations/utils.py", line 35, in make_request
    raise exc
  File "apps/frappe/frappe/integrations/utils.py", line 19, in make_request
    response = frappe.flags.integration_request = s.request(
                                                  ^^^^^^^^^^
  File "env/lib/python3.11/site-packages/requests/sessions.py", line 575, in request
    prep = self.prepare_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "env/lib/python3.11/site-packages/requests/sessions.py", line 484, in prepare_request
    p.prepare(
  File "env/lib/python3.11/site-packages/requests/models.py", line 367, in prepare
    self.prepare_url(url, params)
  File "env/lib/python3.11/site-packages/requests/models.py", line 438, in prepare_url
    raise MissingSchema(
requests.exceptions.MissingSchema: Invalid URL 'None/None/399172773270903/message_templates': No scheme supplied. Perhaps you meant https://None/None/399172773270903/message_templates?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1768, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/form/save.py", line 39, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 359, in _save
    return self.insert()
           ^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 308, in insert
    self.run_method("after_insert")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe_whatsapp/frappe_whatsapp/frappe_whatsapp/doctype/whatsapp_templates/whatsapp_templates.py", line 114, in after_insert
    res = frappe.flags.integration_request.json()["error"]
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'json'

### Request Data
{
	"type": "POST",
	"args": {
		"doc": "{\"docstatus\":0,\"doctype\":\"WhatsApp Templates\",\"name\":\"new-whatsapp-templates-faiixjcipg\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"rawscholar.dev@gmail.com\",\"status\":\"Pending\",\"category\":\"TRANSACTIONAL\",\"language\":\"en\",\"header_type\":\"\",\"template_name\":\"Rawscholar\",\"template\":\"hello there\"}",
		"action": "Save"
	},
	"btn": {
		"jQuery370070970975159293491": {
			"events": {
				"click": [
					{
						"type": "click",
						"origType": "click",
						"guid": 501,
						"namespace": ""
					}
				]
			}
		}
	},
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.form.save.savedocs",
	"request_id": "4ebe3db6-94ab-448f-a5df-869196c8d553"
}

### Response Data
{
	"exception": "AttributeError: 'NoneType' object has no attribute 'json'",
	"exc_type": "AttributeError",
	"_exc_source": "frappe_whatsapp (app)"
}
```how to deal with this error

this error is on the production site, anyone knows how to solve this error??

anyone??

@rameez-rizvan value of frappe.flags.integration_request is None

how to correct this error as i have installed frappe whatsapp on production site

@rameez-rizvan i got same error so i remove frappe.flags.integration_request

where can i find it?

File “apps/frappe_whatsapp/frappe_whatsapp/frappe_whatsapp/doctype/whatsapp_templates/whatsapp_templates.py”, line 114, in after_insert
In your Doctype Whatsapp Template Doctype Python File

2 Likes

@Jeel
i have a question related to frappe_whatsapp installation.

I have installed erpnext and frappe crm. I installed frappe_whatsapp and when the migrate command was run, i got the error:

pymysql.err.ProgrammingError: (‘DocType’, ‘WhatsApp Notification’)

None of the migrations related to WhatsApp got reflected.
How can I resolve this issue?