Forums

pythonanywhere endpoint not receiving request from whatsapp webhook

I made an endpoint on pythonanywhere to be used as webhook for WhatsApp api. During configuring this endpoint from WhatsApp api it sends a request to this endpoint with some data and we have to return a query parameter named 'hub.challange' but the issue I am facing is the endpoint is not receiving any request when I try to configure it. I tried the same endpoint on my local system by using ngrok server and it received the request. Any solution?

How did you configure the webhook on PA side? Is it running as a web app?

yes it's an endpoint of django app.

There's one more problem, I tried to run a langchain model on pythonanywhere and it gave me this error :

from langchain.chat_models import ChatOpenAI File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/init.py", line 6, in <module> from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/agents/init.py", line 31, in <module> from langchain.agents.agent import ( File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/agents/agent.py", line 14, in <module> from langchain.agents.agent_iterator import AgentExecutorIterator File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/agents/agent_iterator.py", line 21, in <module> from langchain.callbacks.manager import ( File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/callbacks/init.py", line 10, in <module> from langchain.callbacks.aim_callback import AimCallbackHandler File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/callbacks/aim_callback.py", line 5, in <module> from langchain.schema import AgentAction, AgentFinish, LLMResult File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/schema/init.py", line 3, in <module> from langchain.schema.cache import BaseCache File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/schema/cache.py", line 6, in <module> from langchain.schema.output import Generation File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/schema/output.py", line 12, in <module> class Generation(Serializable): File "pydantic/main.py", line 197, in pydantic.main.ModelMetaclass.new File "pydantic/fields.py", line 506, in pydantic.fields.ModelField.infer File "pydantic/fields.py", line 436, in pydantic.fields.ModelField.init File "pydantic/fields.py", line 552, in pydantic.fields.ModelField.prepare File "pydantic/fields.py", line 668, in pydantic.fields.ModelField._type_analysis File "/usr/local/lib/python3.10/typing.py", line 1157, in subclasscheck return issubclass(cls, self.origin) TypeError: issubclass() arg 1 must be a class

On googling i found some suggested solutions such as using 4.5.0 version of typing_extensions etc I tried them all but still it gives me same error.https://stackoverflow.com/questions/76313592/import-langchain-error-typeerror-issubclass-arg-1-must-be-a-class

Any suggestion on how to run langchain model?

from langchain.chat_models import ChatOpenAI File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/__init__.py", line 6, in <module> from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/agents/__init__.py", line 31, in <module> from langchain.agents.agent import ( File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/agents/agent.py", line 14, in <module> from langchain.agents.agent_iterator import AgentExecutorIterator File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/agents/agent_iterator.py", line 21, in <module> from langchain.callbacks.manager import ( File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/callbacks/__init__.py", line 10, in <module> from langchain.callbacks.aim_callback import AimCallbackHandler File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/callbacks/aim_callback.py", line 5, in <module> from langchain.schema import AgentAction, AgentFinish, LLMResult class Generation(Serializable): File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/schema/__init__.py", line 3, in <module> from langchain.schema.cache import BaseCache File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/schema/cache.py", line 6, in <module> from langchain.schema.output import Generation File "/home/Junaid0080/.local/lib/python3.10/site-packages/langchain/schema/output.py", line 12, in <module> class Generation(Serializable): File "pydantic/main.py", line 197, in pydantic.main.ModelMetaclass.__new__ File "pydantic/fields.py", line 506, in pydantic.fields.ModelField.infer File "pydantic/fields.py", line 436, in pydantic.fields.ModelField.__init__ File "pydantic/fields.py", line 552, in pydantic.fields.ModelField.prepare File "pydantic/fields.py", line 668, in pydantic.fields.ModelField._type_analysis File "/usr/local/lib/python3.10/typing.py", line 1157, in __subclasscheck__ return issubclass(cls, self.__origin__) TypeError: issubclass() arg 1 must be a class

That really looks like an issue that you may have to raise with the authors of langchain.

and what about the whatsapp webhook issue that i have mentioned above?

Do you see a request in your access log for the hit to the webhook?

No There's nothing in access log. That's the problem.

I tired around 10 times but there was just one hit in access log but the query parameters in the request were still empty.

If there is no hit in the access log (success or error), then you are using the wrong address for the webhook. Make sure that the address that you have configured for the webhook is correct.

the address is correct I checked it multiple times, and the same address got hit just once but with empty query parameters.

Did you change anything between those 10 tries?

Ni I didn't. Can you check app on my account?

What ip are the hits coming from?