fbchat-dev / fbchat-dev/fbchat

Error when getting jsmods_require: {} Facebook might have changed protocol

Open
#604 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.2k
Forks
403
PR merge metrics
No merged PRs in 30d

Description

## Description of the problem
Sending messages fails with the message Error when getting jsmods_require: {$JSON} Facebook might have changed protocol

## Code to reproduce
```py
import getpass
import fbchat
from fbchat import Client
from fbchat.models import *

client = Client("[redacted]", getpass.getpass())

message_id = client.send(Message(text='test message'), thread_id=client.uid, thread_type=ThreadType.USER)

```

## Traceback
```
Traceback (most recent call last):
File "", line 1, in
File "/home/ktbsh/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/201.7223.92/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/home/ktbsh/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/201.7223.92/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/ktbsh/PycharmProjects/fb_zen/src/fbzen.py", line 8, in
message_id = client.send(Message(text='test message'), thread_id=client.uid, thread_type=ThreadType.USER)
File "/home/ktbsh/PycharmProjects/fb_zen/venv/lib/python3.8/site-packages/fbchat/_client.py", line 1061, in send
return self._doSendRequest(data)
File "/home/ktbsh/PycharmProjects/fb_zen/venv/lib/python3.8/site-packages/fbchat/_client.py", line 1037, in _doSendRequest
mid, thread_id = self._state._do_send_request(data)
File "/home/ktbsh/PycharmProjects/fb_zen/venv/lib/python3.8/site-packages/fbchat/_state.py", line 316, in _do_send_request
fb_dtsg = _util.get_jsmods_require(j, 2)
File "/home/ktbsh/PycharmProjects/fb_zen/venv/lib/python3.8/site-packages/fbchat/_util.py", line 208, in get_jsmods_require
raise e
File "/home/ktbsh/PycharmProjects/fb_zen/venv/lib/python3.8/site-packages/fbchat/_util.py", line 202, in get_jsmods_require
return j["jsmods"]["require"][0][index][0]
IndexError: list index out of range
```

## Environment information
- Python version (latest at the time of writing)
- `fbchat` version (latest at the time of writing)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.