mautrix / instagram Goto Github PK
View Code? Open in Web Editor NEWA Matrix-Instagram DM puppeting bridge
Home Page: https://matrix.to/#/#instagram:maunium.net
License: GNU Affero General Public License v3.0
A Matrix-Instagram DM puppeting bridge
Home Page: https://matrix.to/#/#instagram:maunium.net
License: GNU Affero General Public License v3.0
Sending or receiving a story in DM in Instagram app would trigger the download of the story by the bridge, as it needs to show the message in the bridged room.
However, since a month ago (roughly late November 2022), only an image would be downloaded and shown in the bridged room, regardless of the type of story. In other words, it would always download a still picture no matter the story is, indeed, a still picture, or a video.
I just updated the bridge after #65 was merged and found a lot of errors in my logs, each followed by an exception. Everything works completely fine tho (as far as I tested).
$ docker logs mautrix-instagram 2>&1 | grep ERROR
[2022-12-15 18:14:15,514] [[email protected].@severin:schueller.xyz] Failed to sync threads. Waiting 30 seconds before retrying sync.
[2022-12-15 18:15:04,356] [[email protected].@severin:schueller.xyz] Failed to sync threads. Waiting 30 seconds before retrying sync.
[2022-12-15 18:15:58,411] [[email protected].@severin:schueller.xyz] Failed to sync threads. Waiting 30 seconds before retrying sync.
[2022-12-15 18:16:58,861] [[email protected].@severin:schueller.xyz] Failed to sync threads. Waiting 30 seconds before retrying sync.
[2022-12-15 18:18:02,422] [[email protected].@severin:schueller.xyz] Failed to sync threads. Waiting 30 seconds before retrying sync.
[2022-12-15 18:18:32,425] [[email protected].@severin:schueller.xyz] Failed to sync threads five times. Will not retry.
[2022-12-15 18:22:59,773] [[email protected].@severin:schueller.xyz] Failed to backfill portal 340282366841710300949128127470726605830:
[2022-12-15 18:23:00,906] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:01,159] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:01,433] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:01,707] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:01,958] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:02,185] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:02,430] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:02,729] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:02,989] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:23,203] [[email protected].@severin:schueller.xyz] Failed to backfill portal ID1: duplicate key value violates unique constraint "message_pkey"
[2022-12-15 18:23:43,489] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:43,725] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:43,978] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:44,196] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:44,446] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:23:44,705] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:24:04,756] [[email protected].@severin:schueller.xyz] Failed to backfill portal ID2: duplicate key value violates unique constraint "message_pkey"
[2022-12-15 18:24:41,685] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:24:42,267] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:24:42,993] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:24:43,855] [[email protected]] Failed to store batch message IDs
[2022-12-15 18:25:03,906] [[email protected].@severin:schueller.xyz] Failed to backfill portal ID3: duplicate key value violates unique constraint "message_pkey"
[2022-12-15 18:26:25,621] [[email protected].@severin:schueller.xyz] Failed to backfill portal ID4: duplicate key value violates unique constraint "message_pkey"
[2022-12-15 18:28:10,755] [[email protected].@severin:schueller.xyz] Failed to backfill portal ID4: duplicate key value violates unique constraint "message_pkey"
[2022-12-15 18:15:58,411] [[email protected].@severin:schueller.xyz] Failed to sync threads. Waiting 30 seconds before retrying sync.
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/mautrix_instagram/user.py", line 823, in run_with_sync_lock
await func()
File "/usr/lib/python3.10/site-packages/mautrix_instagram/user.py", line 760, in _backfill_threads
await self._sync_threads_with_delay(
File "/usr/lib/python3.10/site-packages/mautrix_instagram/user.py", line 796, in _sync_threads_with_delay
had_new_messages = await self._sync_thread(thread)
File "/usr/lib/python3.10/site-packages/mautrix_instagram/user.py", line 612, in _sync_thread
await portal.send_post_backfill_dummy(
File "/usr/lib/python3.10/site-packages/mautrix_instagram/portal.py", line 2249, in send_post_backfill_dummy
await DBMessage(
File "/usr/lib/python3.10/site-packages/mautrix_instagram/db/message.py", line 49, in insert
await self.db.execute(
File "/usr/lib/python3.10/site-packages/mautrix/util/async_db/database.py", line 136, in execute
return await conn.execute(query, *args, timeout=timeout)
File "/usr/lib/python3.10/site-packages/mautrix/util/async_db/connection.py", line 38, in wrapper
ret = await func(self, arg, *args, **kwargs)
File "/usr/lib/python3.10/site-packages/mautrix/util/async_db/connection.py", line 81, in execute
return await self.wrapped.execute(query, *args, timeout=timeout)
File "/usr/lib/python3.10/site-packages/asyncpg/connection.py", line 319, in execute
_, status, _ = await self._execute(
File "/usr/lib/python3.10/site-packages/asyncpg/connection.py", line 1658, in _execute
result, _ = await self.__execute(
File "/usr/lib/python3.10/site-packages/asyncpg/connection.py", line 1683, in __execute
return await self._do_execute(
File "/usr/lib/python3.10/site-packages/asyncpg/connection.py", line 1730, in _do_execute
result = await executor(stmt, None)
File "asyncpg/protocol/protocol.pyx", line 201, in bind_execute
asyncpg.exceptions.UniqueViolationError: duplicate key value violates unique constraint "message_pkey"
DETAIL: Key (item_id, receiver)=(, SHORT_ID) already exists.
[2022-12-15 18:23:44,196] [[email protected]] Failed to store batch message IDs
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/mautrix_instagram/portal.py", line 2214, in _finish_batch
await DBMessage.bulk_insert(messages)
File "/usr/lib/python3.10/site-packages/mautrix_instagram/db/message.py", line 66, in bulk_insert
await conn.copy_records_to_table("message", records=records, columns=columns)
File "/usr/lib/python3.10/site-packages/mautrix/util/async_db/connection.py", line 38, in wrapper
ret = await func(self, arg, *args, **kwargs)
File "/usr/lib/python3.10/site-packages/mautrix/util/async_db/connection.py", line 151, in copy_records_to_table
return await self.wrapped.copy_records_to_table(
File "/usr/lib/python3.10/site-packages/asyncpg/connection.py", line 983, in copy_records_to_table
return await self._protocol.copy_in(
File "asyncpg/protocol/protocol.pyx", line 529, in copy_in
asyncpg.exceptions.UniqueViolationError: duplicate key value violates unique constraint "message_pkey"
DETAIL: Key (item_id, receiver)=(ID5, SHORT_ID) already exists.
[2022-12-15 18:28:10,755] [[email protected].@severin:schueller.xyz] Failed to backfill portal ID4: duplicate key value violates unique constraint "message_pkey"
DETAIL: Key (item_id, receiver)=(, SHORT_ID) already exists.
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/mautrix_instagram/user.py", line 314, in _handle_backfill_requests_loop
await portal.backfill(self, req)
File "/usr/lib/python3.10/site-packages/mautrix_instagram/portal.py", line 1826, in backfill
await self.send_post_backfill_dummy(last_message_ig_timestamp)
File "/usr/lib/python3.10/site-packages/mautrix_instagram/portal.py", line 2249, in send_post_backfill_dummy
await DBMessage(
File "/usr/lib/python3.10/site-packages/mautrix_instagram/db/message.py", line 49, in insert
await self.db.execute(
File "/usr/lib/python3.10/site-packages/mautrix/util/async_db/database.py", line 136, in execute
return await conn.execute(query, *args, timeout=timeout)
File "/usr/lib/python3.10/site-packages/mautrix/util/async_db/connection.py", line 38, in wrapper
ret = await func(self, arg, *args, **kwargs)
File "/usr/lib/python3.10/site-packages/mautrix/util/async_db/connection.py", line 81, in execute
return await self.wrapped.execute(query, *args, timeout=timeout)
File "/usr/lib/python3.10/site-packages/asyncpg/connection.py", line 319, in execute
_, status, _ = await self._execute(
File "/usr/lib/python3.10/site-packages/asyncpg/connection.py", line 1658, in _execute
result, _ = await self.__execute(
File "/usr/lib/python3.10/site-packages/asyncpg/connection.py", line 1683, in __execute
return await self._do_execute(
File "/usr/lib/python3.10/site-packages/asyncpg/connection.py", line 1730, in _do_execute
result = await executor(stmt, None)
File "asyncpg/protocol/protocol.pyx", line 201, in bind_execute
asyncpg.exceptions.UniqueViolationError: duplicate key value violates unique constraint "message_pkey"
DETAIL: Key (item_id, receiver)=(, SHORT_ID) already exists.
I replaced some IDs as I'm not sure wehter these are sensible information.
Bridge version: mautrix-instagram 0.2.3+dev.6556cbb7
Synapse version: 1.73.0
Version: mautrix-instagram 0.2.2
Some rooms that were previously configured with the set-relay command to be able to retransmit messages are not working correctly. What is happening is that they are not rebroadcasting messages.
This image is from the first time I sent the command to the room.
Logs:
[2022-11-28 22:38:21,793] [[email protected]] Received Matrix event $wQglAzyM6iF20ynceR73VSinELw3_ntzROi22buL5t8 from @menubot:calidex.co in !silyLXfjrPMPyZbCpI:calidex.co
[2022-11-28 22:38:21,793] [[email protected]] Ignoring event $wQglAzyM6iF20ynceR73VSinELw3_ntzROi22buL5t8 from @menubot:calidex.co: not allowed to send to portal
DB:
mautrix_instagram=# select * from portal where mxid = '!silyLXfjrPMPyZbCpI:calidex.co';
thread_id | receiver | other_user_pk | mxid | name | avatar_url | name_set | avatar_set | encrypted | relay_user_id
-----------------------------------------+------------+---------------+--------------------------------+------------------------+-------------------------------------------+----------+------------+-----------+------------------
xyz | xyz | xyz | !silyLXfjrPMPyZbCpI:calidex.co | Alejandro Herrera (IG) | mxc://calidex.co/tImCgzezNeMjCHoisfjkQlml | t | t | f | @acd2:calidex.co
After sending the set-realy command again, the retransmissions were working again.
fresh install on a private synapse server. I can succesfully log in, but get instantly logged out. Here's the traceback:
Traceback (most recent call last):
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 212, in _dict_to_attrs
obj = attrs_type(**new_items)
TypeError: init() missing 1 required keyword-only argument: 'biography_product_mentions'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix_instagram/user.py", line 181, in try_connect
await self.connect()
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix_instagram/user.py", line 204, in connect
resp = await client.current_user()
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mauigpapi/http/account.py", line 29, in current_user
return await self.std_http_get(
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mauigpapi/http/base.py", line 177, in std_http_get
return response_type.deserialize(json_data)
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 375, in deserialize
return _dict_to_attrs(cls, data)
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 198, in _dict_to_attrs
new_items[name] = _try_deserialize(field_meta, value)
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 229, in _try_deserialize
return _deserialize(field.type, value, field.default)
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 267, in _deserialize
return _dict_to_attrs(cls, value, default, default_if_empty=True)
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 218, in _dict_to_attrs
raise SerializerError(
mautrix.types.util.serializable.SerializerError: Missing value for required key biography_product_mentions in CurrentUser
Let me know if I can provide any more meaningful troubleshoot info.
is 2FA required for this bridge? is this new?
Probably related to #71.
After a restart (and update to mautrix-instagram 0.2.3+dev.6f40e012
) of the bridge I found another exception. Like in #71 it occurred during thread sync, but this time it raises a different error.
[2022-12-16 19:50:12,802] [[email protected].@severin:schueller.xyz] Failed to sync threads. Waiting 30 seconds before retrying sync.
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/mautrix_instagram/user.py", line 823, in run_with_sync_lock
await func()
File "/usr/lib/python3.10/site-packages/mautrix_instagram/user.py", line 760, in _backfill_threads
await self._sync_threads_with_delay(
File "/usr/lib/python3.10/site-packages/mautrix_instagram/user.py", line 796, in _sync_threads_with_delay
had_new_messages = await self._sync_thread(thread)
File "/usr/lib/python3.10/site-packages/mautrix_instagram/user.py", line 604, in _sync_thread
base_insertion_event_id = await portal.backfill_message_page(
File "/usr/lib/python3.10/site-packages/mautrix_instagram/portal.py", line 2166, in backfill_message_page
batch_send_resp = await self.main_intent.batch_send(
File "/usr/lib/python3.10/site-packages/mautrix/appservice/api/intent.py", line 536, in batch_send
resp = await self.api.request(
File "/usr/lib/python3.10/site-packages/mautrix/api.py", line 401, in request
resp_data, resp = await self._send(
File "/usr/lib/python3.10/site-packages/mautrix/api.py", line 256, in _send
raise make_request_error(
mautrix.errors.request.MForbidden: Application service has not registered this user (@instagram_ID:schueller.xyz)
When installing the bridge following error occurs:
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix_instagram/__main__.py", line 22, in <module>
from .db import upgrade_table, init as init_db
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix_instagram/db/__init__.py", line 4, in <module>
from .user import User
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix_instagram/db/user.py", line 21, in <module>
from mauigpapi.state import AndroidState
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mauigpapi/__init__.py", line 1, in <module>
from .state import AndroidState
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mauigpapi/state/__init__.py", line 1, in <module>
from .state import AndroidState
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mauigpapi/state/state.py", line 28, in <module>
from .device import AndroidDevice
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mauigpapi/state/device.py", line 29, in <module>
builds = json.loads(pkgutil.get_data("mauigpapi.state", "samples/builds.json"))
File "/usr/lib/python3.9/pkgutil.py", line 638, in get_data
return loader.get_data(resource_name)
File "<frozen importlib._bootstrap_external>", line 979, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/opt/mautrix-instagram/lib/python3.9/site-packages/mauigpapi/state/samples/builds.json'
I've installed in a new venv on a new user.
pip freeze
aiohttp==3.7.4.post0
async-timeout==3.0.1
asyncpg==0.21.0
attrs==20.3.0
cffi==1.14.5
chardet==4.0.0
commonmark==0.9.1
future==0.18.2
idna==3.1
mautrix==0.8.16
mautrix-instagram==0.1.0b1
multidict==5.1.0
paho-mqtt==1.5.1
Pillow==8.1.2
prometheus-client==0.9.0
pycparser==2.20
pycryptodome==3.10.1
python-magic==0.4.22
python-olm==3.1.3
ruamel.yaml==0.16.13
ruamel.yaml.clib==0.2.2
typing-extensions==3.7.4.3
unpaddedbase64==1.1.0
yarl==1.6.3
The packages were installed (while venv was activated) with the following command:
pip install -U pip mautrix-instagram[all]
Could we look into adding support for Spaces so that DMs can be grouped easily in clients?
I logged out in the bridge, changed IG password on the web, then logged in on the web without any error, then tried to log in with the bridge, and I get this error every time:
Unhandled error while handling command:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/mautrix_instagram/commands/auth.py", line 77, in login
resp = await api.login(username, password)
File "/opt/mautrix-instagram/mauigpapi/http/login.py", line 58, in login
return await self.std_http_post(
File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 158, in std_http_post
json_data = await self._handle_response(resp)
File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 191, in _handle_response
await self._raise_response_error(resp)
File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 213, in _raise_response_error
raise err
mauigpapi.errors.response.IGChallengeError: Request POST /api/v1/accounts/login/ failed: challenge_required
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/mautrix/bridge/commands/handler.py", line 491, in handle
await self._run_handler(handler, evt)
File "/usr/lib/python3.10/site-packages/mautrix/bridge/commands/handler.py", line 340, in __call__
return await self._handler(evt)
File "/usr/lib/python3.10/site-packages/mautrix_instagram/commands/auth.py", line 100, in login
await api.challenge_auto(reset=True)
File "/opt/mautrix-instagram/mauigpapi/http/challenge.py", line 107, in challenge_auto
challenge = self.state.challenge or await self.challenge_get_state()
File "/opt/mautrix-instagram/mauigpapi/http/challenge.py", line 35, in challenge_get_state
await self.std_http_get(self.__path, query=query, response_type=ChallengeStateResponse)
File "/opt/mautrix-instagram/mauigpapi/http/challenge.py", line 26, in __path
return f"/api/v1{self.state.challenge_path}"
File "/opt/mautrix-instagram/mauigpapi/state/state.py", line 77, in challenge_path
raise IGNoChallengeError()
mauigpapi.errors.state.IGNoChallengeError: No challenge data available
After it happens, I need to accept a "was this you" screen on the web:
I suppose this is what the bridge is presented, too, and so it can't login. Maybe the screen is different from what the bridge expects, so that's why there is "no challenge data available" or I don't know.
I have 3 files:
docker-compose.yml
with conduit server, element and mautrix-instagram
version: '3'
services:
homeserver:
### If you already built the Conduit image with 'docker build' or want to use a registry image,
### then you are ready to go.
image: matrixconduit/matrix-conduit:latest
### If you want to build a fresh image from the sources, then comment the image line and uncomment the
### build lines. If you want meaningful labels in your built Conduit image, you should run docker-compose like this:
### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker-compose up -d
# build:
# context: .
# args:
# CREATED: '2021-03-16T08:18:27Z'
# VERSION: '0.1.0'
# LOCAL: 'false'
# GIT_REF: origin/master
restart: unless-stopped
ports:
- 8448:6167
volumes:
- db:/var/lib/matrix-conduit/
environment:
CONDUIT_SERVER_NAME: your.server.name # EDIT THIS
CONDUIT_DATABASE_PATH: /var/lib/matrix-conduit/
CONDUIT_DATABASE_BACKEND: rocksdb
CONDUIT_PORT: 6167
CONDUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
CONDUIT_ALLOW_REGISTRATION: 'true'
CONDUIT_ALLOW_FEDERATION: 'true'
CONDUIT_TRUSTED_SERVERS: '["matrix.org"]'
#CONDUIT_MAX_CONCURRENT_REQUESTS: 100
#CONDUIT_LOG: warn,rocket=off,_=off,sled=off
CONDUIT_ADDRESS: 0.0.0.0
CONDUIT_CONFIG: '' # Ignore this
## Uncomment if you want to use your own Element-Web App.
## Note: You need to provide a config.json for Element and you also need a second
## Domain or Subdomain for the communication between Element and Conduit
## Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md
element-web:
image: vectorim/element-web:latest
restart: unless-stopped
ports:
- 8009:80
volumes:
- ./element_config.json:/app/config.json
depends_on:
- homeserver
mautrix-instagram:
container_name: mautrix-instagram
image: dock.mau.dev/mautrix/instagram
restart: unless-stopped
volumes:
- .:/data
volumes:
db:
Element_config.json
{
"default_server_config": {
"m.homeserver": {
"base_url": "http://localhost:8448"
}
}
}
and automatically generated config.yaml
I couldn't open it as user so changed his permissions using
sudo chown $USER config.yaml
content of config.yml
is
# Homeserver details
homeserver:
# The address that this appservice can use to connect to the homeserver.
address: http://localhost:8448
# The domain of the homeserver (for MXIDs, etc).
domain: your.server.name
# Whether or not to verify the SSL certificate of the homeserver.
# Only applies if address starts with https://
verify_ssl: false
# What software is the homeserver running?
# Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here.
software: standard
# Number of retries for all HTTP requests if the homeserver isn't reachable.
http_retry_count: 4
# The URL to push real-time bridge status to.
# If set, the bridge will make POST requests to this URL whenever a user's Instagram MQTT connection state changes.
# The bridge will use the appservice as_token to authorize requests.
status_endpoint:
# Endpoint for reporting per-message status.
message_send_checkpoint_endpoint:
# Whether asynchronous uploads via MSC2246 should be enabled for media.
# Requires a media repo that supports MSC2246.
async_media: false
# Application service host/registration related details
# Changing these values requires regeneration of the registration.
appservice:
# The address that the homeserver can use to connect to this appservice.
address: http://localhost:29330
# When using https:// the TLS certificate and key files for the address.
tls_cert: false
tls_key: false
# The hostname and port where this appservice should listen.
hostname: 0.0.0.0
port: 29330
# The maximum body size of appservice API requests (from the homeserver) in mebibytes
# Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
max_body_size: 1
# The full URI to the database. SQLite and Postgres are supported.
# Format examples:
# SQLite: sqlite:///filename.db
# Postgres: postgres://username:password@hostname/dbname
database: sqlite:///filename.db
# Additional arguments for asyncpg.create_pool() or sqlite3.connect()
# https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool
# https://docs.python.org/3/library/sqlite3.html#sqlite3.connect
# For sqlite, min_size is used as the connection thread pool size and max_size is ignored.
# Additionally, SQLite supports init_commands as an array of SQL queries to run on connect (e.g. to set PRAGMAs).
database_opts:
min_size: 1
max_size: 10
id: instagram
# Username of the appservice bot.
bot_username: instagrambot
# Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
# to leave display name/avatar as-is.
bot_displayname: Instagram bridge bot
bot_avatar: mxc://maunium.net/JxjlbZUlCPULEeHZSwleUXQv
# Whether or not to receive ephemeral events via appservice transactions.
# Requires MSC2409 support (i.e. Synapse 1.22+).
# You should disable bridge -> sync_with_custom_puppets when this is enabled.
ephemeral_events: true
# Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
as_token: This value is generated when generating the registration
hs_token: This value is generated when generating the registration
# Prometheus telemetry config. Requires prometheus-client to be installed.
metrics:
enabled: false
listen_port: 8000
# Manhole config.
manhole:
# Whether or not opening the manhole is allowed.
enabled: false
# The path for the unix socket.
path: /var/tmp/mautrix-instagram.manhole
# The list of UIDs who can be added to the whitelist.
# If empty, any UIDs can be specified in the open-manhole command.
whitelist:
- 0
instagram:
# Seed for generating devices. This is secret because the seed is used to generate
# device IDs, which can apparently be used to bypass two-factor authentication after
# logging out, because Instagram is insecure.
device_seed: 6_3g-7Ze3qzr6rESpNwlV7lKat7_x6vJGFBaUec64S9rLmVUEMioeNKyzwcoYOz5
# Bridge config
bridge:
# Localpart template of MXIDs for Instagram users.
# {userid} is replaced with the user ID of the Instagram user.
username_template: instagram_{userid}
# Displayname template for Instagram users.
# {displayname} is replaced with the display name of the Instagram user.
# {username} is replaced with the username of the Instagram user.
displayname_template: '{displayname} (Instagram)'
# Displayname template for 1:1 chat portals. Same variables as displayname_template.
private_chat_name_template: '{displayname}'
# Displayname template for group chat portals. Only {name} is available.
group_chat_name_template: '{name}'
# Maximum length of displayname
displayname_max_length: 100
# The maximum number of conversations that should be synced when we get a
# message sync error. In general, 1 page (20) is sufficient.
max_startup_thread_sync_count: 20
# Whether or not to use /sync to get read receipts and typing notifications
# when double puppeting is enabled
sync_with_custom_puppets: false
# Whether or not to update the m.direct account data event when double puppeting is enabled.
# Note that updating the m.direct event is not atomic (except with mautrix-asmux)
# and is therefore prone to race conditions.
sync_direct_chat_list: false
# Allow using double puppeting from any server with a valid client .well-known file.
double_puppet_allow_discovery: false
# Servers to allow double puppeting from, even if double_puppet_allow_discovery is false.
double_puppet_server_map:
example.com: https://example.com
login_shared_secret_map:
example.com: foo
federate_rooms: true
# Settings for backfilling messages from Instagram.
backfill:
# Whether to enable backfilling at all.
#
# This requires a server with MSC2716 support, which is currently an
# experimental feature in synapse. It can be enabled by setting
# experimental_features -> msc2716_enabled to true in homeserver.yaml.
#
# Note that prior to Synapse 1.49, there were some bugs with the
# implementation, especially if using event persistence workers. There
# are also still some issues in Synapse's federation implementation.
enable: false
# Use MSC2716 for backfilling? If this is disabled, backfilling only happens when syncing threads,
# and the incremental settings below don't apply.
#
# This requires a server with MSC2716 support, which is currently an experimental feature in Synapse.
# It can be enabled by setting experimental_features -> msc2716_enabled to true in homeserver.yaml.
msc2716: false
# Use double puppets for backfilling?
# In order to use this, the double puppets must be in the appservice's user ID namespace
# (because the bridge can't use the double puppet access token with batch sending).
# This only affects double puppets on the local server, double puppets on other servers will never be used.
double_puppet_backfill: false
# The maximum number of conversations that should be synced.
# Other conversations will be backfilled on demand when the start PM
# provisioning endpoint is used or when a message comes in from that
# chat.
# If set to -1, all conversations will by synced.
max_conversations: 20
# The minimum amount of time to wait between syncing each thread. This
# helps avoid situations where you sync too quickly.
min_sync_thread_delay: 5
# If this value is greater than 0, then if the conversation's last
# message was more than this number of hours ago, then the conversation
# will automatically be marked it as read.
# Conversations that have a last message that is less than this number
# of hours ago will have their unread status synced from Instagram.
unread_hours_threshold: 0
# Settings for how quickly to backoff when rate-limits are encountered
# while backfilling.
backoff:
# How many seconds to wait after getting rate limited during a
# thread list fetch.
thread_list: 300
# How many seconds to wait after getting rate limited during a
# message history fetch.
message_history: 300
# Settings for backfills.
#
# During initial/incremental sync, the entirety of the thread that is
# available will be backfilled. For example, on initial sync, about 20
# messages are included for each thread in the thread list returned by
# the server. After that, incremental backfills will be run for each of
# the portals in a round-robin fashion until all portals have been
# backfilled as configured below.
incremental:
# The maximum number of pages to backfill per batch.
max_pages: 10
# The maximum number of total pages to backfill per portal.
# If set to -1, infinite pages will be synced.
max_total_pages: -1
# The number of seconds to wait between backfilling each page.
page_delay: 5
# The number of seconds to wait after backfilling the batch of
# messages.
post_batch_delay: 20
periodic_reconnect:
# Interval in seconds in which to automatically reconnect all users.
# This can be used to automatically mitigate the bug where Instagram stops sending messages.
# Set to -1 to disable periodic reconnections entirely.
interval: -1
# Whether or not the bridge should backfill chats when reconnecting.
resync: true
# Should even disconnected users be reconnected?
always: false
# URL to call to retrieve a proxy URL from (defaults to the http_proxy environment variable).
get_proxy_api_url:
# End-to-bridge encryption support options.
#
# See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
encryption:
# Allow encryption, work in group chat rooms with e2ee enabled
allow: false
# Default to encryption, force-enable encryption in all portals the bridge creates
# This will cause the bridge bot to be in private chats for the encryption to work properly.
default: false
# Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data.
appservice: false
# Require encryption, drop any unencrypted messages.
require: false
# Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
# You must use a client that supports requesting keys from other users to use this feature.
allow_key_sharing: false
# What level of device verification should be required from users?
#
# Valid levels:
# unverified - Send keys to all device in the room.
# cross-signed-untrusted - Require valid cross-signing, but trust all cross-signing keys.
# cross-signed-tofu - Require valid cross-signing, trust cross-signing keys on first use (and reject changes).
# cross-signed-verified - Require valid cross-signing, plus a valid user signature from the bridge bot.
# Note that creating user signatures from the bridge bot is not currently possible.
# verified - Require manual per-device verification
# (currently only possible by modifying the `trust` column in the `crypto_device` database table).
verification_levels:
# Minimum level for which the bridge should send keys to when bridging messages from Telegram to Matrix.
receive: unverified
# Minimum level that the bridge should accept for incoming Matrix messages.
send: unverified
# Minimum level that the bridge should require for accepting key requests.
share: cross-signed-tofu
# Options for Megolm room key rotation. These options allow you to
# configure the m.room.encryption event content. See:
# https://spec.matrix.org/v1.3/client-server-api/#mroomencryption for
# more information about that event.
rotation:
# Enable custom Megolm room key rotation settings. Note that these
# settings will only apply to rooms created after this option is
# set.
enable_custom: false
# The maximum number of milliseconds a session should be used
# before changing it. The Matrix spec recommends 604800000 (a week)
# as the default.
milliseconds: 604800000
# The maximum number of messages that should be sent with a given a
# session before changing it. The Matrix spec recommends 100 as the
# default.
messages: 100
# Whether or not to explicitly set the avatar and room name for private
# chat portal rooms. This will be implicitly enabled if encryption.default is true.
private_chat_portal_meta: false
# Whether or not the bridge should send a read receipt from the bridge bot when a message has
# been sent to Instagram.
delivery_receipts: false
# Whether or not delivery errors should be reported as messages in the Matrix room.
delivery_error_reports: false
# Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
message_status_events: false
# Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
# This field will automatically be changed back to false after it,
# except if the config file is not writable.
resend_bridge_info: false
# Whether or not unimportant bridge notices should be sent to the user.
# (e.g. connected, disconnected but will retry)
unimportant_bridge_notices: true
# Disable bridge notices entirely
disable_bridge_notices: false
# Send captions in the same message as images. This will send data compatible with both MSC2530 and MSC3552.
# This is currently not supported in most clients.
caption_in_message: false
# Should Matrix m.notice-type messages be bridged?
bridge_notices: true
# Provisioning API part of the web server for automated portal creation and fetching information.
# Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
provisioning:
# Whether or not the provisioning API should be enabled.
enabled: true
# The prefix to use in the provisioning API endpoints.
prefix: /_matrix/provision/v1
# The shared secret to authorize users of the API.
# Set to "generate" to generate and save a new token.
shared_secret: SIVYauktlF9EP7B6vFqKDAD6p6KpYwsmJ3J3ddWAFIbuYd2PVYsyYvUk97-xZflA
# Segment API key to enable analytics tracking for web server endpoints. Set to null to disable.
segment_key:
# The prefix for commands. Only required in non-management rooms.
command_prefix: '!ig'
# Permissions for using the bridge.
# Permitted values:
# relay - Allowed to be relayed through the bridge, no access to commands.
# user - Use the bridge with puppeting.
# admin - Use and administrate the bridge.
# Permitted keys:
# * - All Matrix users
# domain - All users on that homeserver
# mxid - Specific user
permissions:
"*": admin
# "*": relay
# "your.server.name": user
# "@gustawdaniel:your.server.name": admin
relay:
# Whether relay mode should be allowed. If allowed, `!ig set-relay` can be used to turn any
# authenticated user into a relaybot for that chat.
enabled: false
# The formats to use when sending messages to Instagram via a relay user.
#
# Available variables:
# $sender_displayname - The display name of the sender (e.g. Example User)
# $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
# $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
# $message - The message content
#
# Note that Instagram doesn't support captions for images, so images won't include any indication of being relayed.
message_formats:
m.text: '$sender_displayname: $message'
m.notice: '$sender_displayname: $message'
m.emote: '* $sender_displayname $message'
# Python logging configuration.
#
# See section 16.7.2 of the Python documentation for more info:
# https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
logging:
version: 1
formatters:
colored:
(): mautrix_instagram.util.ColorFormatter
format: '[%(asctime)s] [%(levelname)s@%(name)s] %(message)s'
normal:
format: '[%(asctime)s] [%(levelname)s@%(name)s] %(message)s'
handlers:
console:
class: logging.StreamHandler
formatter: colored
loggers:
mau:
level: DEBUG
mauigpapi:
level: DEBUG
aiohttp:
level: INFO
paho.mqtt:
level: INFO
root:
level: DEBUG
handlers: [console]
After docker-compose up
I see:
mautrix-instagram | [2022-12-27 22:40:33,721] [[email protected]] Configuration error: bridge.permissions not configured
mautrix-instagram exited with code 11
Hello,
I'm using your bridge and everything works pretty well except I realized that there is a latency between the moment someone starts to write to me and the moment I see it.
So when I'm talking with someone, I see a brief "typing..." with a message straight after, then the "typing..." sticks there (or reappears) for a while and disappears randomly without any other message received. It's happening on every conversation so it's not just someone being very hesitant about their messages hehe.
Am I the only one ?
Thanks you guys
As the title says, I'm trying to send a basic h264 video that's around 6mb, it fails when dragging it in the app, but if I reforward it in the same conversation, it goes through instagram. The bot tells me :
โ Your message was not bridged: Request POST /rupload_igvideo/1685719464714_0_9663460330 failed: HTTP 400
How do I disable this? It's more intuitive to be told that I'm not connected for any reason than to be told regularly with a notification that I am connected. I recall figuring out disabling this for the Facebook Messenger bridge, how would I go about doing it for Instagram?
I use PostgresSQL and if try to create the Registration.yaml i get this error
Virtualenv Python 3.9 latest
source bin/activate
pip install --upgrade https://github.com/tulir/mautrix-instagram/tarball/master#egg=mautrix-instagram[all] \
pip install --upgrade psycopg2-binary
python -m mautrix_instagram -g -c config.yaml
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/opt/matrix/bridges/matrix-appservice-instagram/lib/python3.9/site-packages/mautrix_instagram/__main__.py", line 26, in <module>
from .db import upgrade_table, init as init_db
File "/opt/matrix/bridges/matrix-appservice-instagram/lib/python3.9/site-packages/mautrix_instagram/db/__init__.py", line 4, in <module>
from .user import User
File "/opt/matrix/bridges/matrix-appservice-instagram/lib/python3.9/site-packages/mautrix_instagram/db/user.py", line 21, in <module>
from mauigpapi.state import AndroidState
File "/opt/matrix/bridges/matrix-appservice-instagram/lib/python3.9/site-packages/mauigpapi/__init__.py", line 1, in <module>
from .state import AndroidState
File "/opt/matrix/bridges/matrix-appservice-instagram/lib/python3.9/site-packages/mauigpapi/state/__init__.py", line 1, in <module>
from .state import AndroidState
File "/opt/matrix/bridges/matrix-appservice-instagram/lib/python3.9/site-packages/mauigpapi/state/state.py", line 28, in <module>
from .device import AndroidDevice
File "/opt/matrix/bridges/matrix-appservice-instagram/lib/python3.9/site-packages/mauigpapi/state/device.py", line 29, in <module>
builds = json.loads(pkgutil.get_data("mauigpapi.state", "samples/builds.json"))
File "/usr/lib/python3.9/pkgutil.py", line 638, in get_data
return loader.get_data(resource_name)
File "<frozen importlib._bootstrap_external>", line 979, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/opt/matrix/bridges/matrix-appservice-instagram/lib/python3.9/site-packages/mauigpapi/state/samples/builds.json'
Reproduction steps:
for me, no message is sent from Instagram bridge bot. If possible, I'd like to get a message that a reel failed to send so I at least know to check instagram.
this is new behavior. I kept getting signed out randomly so I enabled 2FA. now with 2FA it's even worse. I tried upgrading the bridge, even went to the master branch version, nothing helped
Homeserver: Conduit 0.2.0
Clients tried: nheko 0.9.1 and Element 1.9.8
Versions tried: release 0.1.2, 0.1.2+dev.0c955be3
, 0.1.2+dev.245e8a20
When I try to send a PNG image, the bridge says, "โ Your message was not bridged: 'NoneType' object has no attribute 'open'" and I see this error in the logs:
Jan 28 00:38:25 server mautrix_instagram[24560]: [2022-01-28 00:38:25,326] [[email protected]] 127.0.0.1 [28/Jan/2022:00:38:25 +0000] "PUT /_matrix/app/v1/transactions/MZ%2D0Q2gDdct85%2D[room]?access_token=[token] HTTP/1.1" 200 158 "-" "-"
Jan 28 00:38:25 server mautrix_instagram[24560]: [2022-01-28 00:38:25,328] [[email protected]] Received Matrix event $53PDD39z_VuAHI9F7VSxQxe1EdoNhxf6qPW762025lg from @user:server.com in ![room]:server.com
Jan 28 00:38:25 server mautrix_instagram[24560]: [2022-01-28 00:38:25,330] [[email protected].[insert id]] Handling Matrix message $53PDD39z_VuAHI9F7VSxQxe1EdoNhxf6qPW762025lg from @user:server.com/[my id] with request ID 6892626872965858786
Jan 28 00:38:25 server mautrix_instagram[24560]: [2022-01-28 00:38:25,347] [[email protected].[insert id]] Fatal error handling Matrix event $53PDD39z_VuAHI9F7VSxQxe1EdoNhxf6qPW762025lg: 'NoneType' object has no attribute 'open'
Jan 28 00:38:25 server mautrix_instagram[24560]: Traceback (most recent call last):
Jan 28 00:38:25 server mautrix_instagram[24560]: File "/home/instagram_bridge/instagram/lib/python3.7/site-packages/mautrix_instagram/portal.py", line 275, in handle_matrix_message
Jan 28 00:38:25 server mautrix_instagram[24560]: await self._handle_matrix_message(sender, message, event_id)
Jan 28 00:38:25 server mautrix_instagram[24560]: File "/home/instagram_bridge/instagram/lib/python3.7/site-packages/mautrix_instagram/portal.py", line 428, in _handle_matrix_message
Jan 28 00:38:25 server mautrix_instagram[24560]: height=message.info.height,
Jan 28 00:38:25 server mautrix_instagram[24560]: File "/home/instagram_bridge/instagram/lib/python3.7/site-packages/mautrix_instagram/portal.py", line 300, in _handle_matrix_image
Jan 28 00:38:25 server mautrix_instagram[24560]: img = Image.open(inp)
Jan 28 00:38:25 server mautrix_instagram[24560]: AttributeError: 'NoneType' object has no attribute 'open'
Jan 28 00:38:25 server mautrix_instagram[24560]: [2022-01-28 00:38:25,421] [[email protected]] 127.0.0.1 [28/Jan/2022:00:38:25 +0000] "PUT /_matrix/app/v1/transactions/YfKDjl1m6SpwoeNgq3e%2D[room]?access_token=[token] HTTP/1.1" 200 158 "-" "-"
(my apologies if I have redacted too much information, I have a copy if anything important is missing)
However, if I send a JPEG image it works fine and sends:
Jan 28 00:51:26 server mautrix_instagram[24560]: [2022-01-28 00:51:26,605] [[email protected]] Received Matrix event $GCUEOkYHZ8d7NhHImp_kQk7SLIEC7fzZZSbusxt4r0A from @user:server.com in ![room]:server.com
Jan 28 00:51:26 server mautrix_instagram[24560]: [2022-01-28 00:51:26,606] [[email protected].[id]] Handling Matrix message $GCUEOkYHZ8d7NhHImp_kQk7SLIEC7fzZZSbusxt4r0A from @user:server.com/[my id] with request ID 6892630149877530901
Jan 28 00:51:29 server mautrix_instagram[24560]: [2022-01-28 00:51:29,658] [[email protected].[id]] Ignoring message 30314108036079811630835115560534016 (6892630149877530901) by [my id] as it was sent by us (client_context in dedup queue)
Jan 28 00:51:29 server mautrix_instagram[24560]: [2022-01-28 00:51:29,989] [[email protected].[id]] Handled Matrix message $GCUEOkYHZ8d7NhHImp_kQk7SLIEC7fzZZSbusxt4r0A (6892630149877530901) -> 30314108036079811630835115560534016
I'm guessing the conversion from PNG -> JPEG is failing?
Thanks in advance to anyone who helps :)
After Login all Devices have to relogin and Appservice sign out instantly, its impossible to use Appservice with Instagram on App or Web .... since today, the last weeks was fine here.... I think Insta have change some on his API Login to reduce some actiivities....
Hi,
I have set up the bridge according to the setup guide and am now trying to login to my account. I have actually tried multiple accounts, some with 2FA, some without, but I just keep getting the following error in my logs:
[2021-03-31 14:35:25,694] [[email protected]] Failed to log in
Traceback (most recent call last):
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix_instagram/commands/auth.py", line 68, in login
resp = await api.login(username, password)
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mauigpapi/http/login.py", line 53, in login
return await self.std_http_post("/api/v1/accounts/login/", data=req,
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mauigpapi/http/base.py", line 121, in std_http_post
json_data = await self._handle_response(resp)
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mauigpapi/http/base.py", line 147, in _handle_response
await self._raise_response_error(resp)
File "/opt/mautrix-instagram/lib/python3.9/site-packages/mauigpapi/http/base.py", line 189, in _raise_response_error
raise IGResponseError(resp, data)
mauigpapi.errors.response.IGResponseError: Request POST /api/v1/accounts/login/ failed: Sorry, there was a problem with your request.
Sadly, the error_type from the API response is not logged, so it's hard to tell what is causing this problem, but it doesn't seem to be caused by incorrect credentials or a sentry block as that would cause different exceptions to be raised.
Is there any way to figure out what is going on there?
Thanks!
I've experienced a number of disconnects since my first use of the bridge (october 2021), and each time, I fail to know that I've been disconnected.
I have the bot's DMs muted because honestly, who likes this stuff ?
That's not really an issue, but when I get the log out messages, I don't know about them and usually spend around 30 minutes to 3 hours to notice that my friends haven't been ghosting me ! (I have a specific space for friends and a specific space for bridges)
I think it could be improved.
Now, I have some ideas in mind :
Sharing a short video to a bridged room results in the error bellow. As the upload process itself seems to be successful, maybe this should be something that's retried after a few seconds.
[[email protected].@philipp:pborn.eu] /api/v1/direct_v2/threads/broadcast/configure_video/ response: {"message":"Transcode not finished yet.","status":"fail"}
[[email protected]] Fatal error handling Matrix event $x4aYkMtXjPfyI3aI7wf2NaQde4xoMU54t4UT4H5qthQ: Request POST /api/v1/direct_v2/threads/broadcast/configure_video/ failed: Transcode not finished yet.
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/mautrix_instagram/portal.py", line 276, in handle_matrix_message
await self._handle_matrix_message(sender, message, event_id)
File "/usr/lib/python3.9/site-packages/mautrix_instagram/portal.py", line 452, in _handle_matrix_message
resp = await self._handle_matrix_video(
File "/usr/lib/python3.9/site-packages/mautrix_instagram/portal.py", line 348, in _handle_matrix_video
return await sender.client.broadcast(
File "/opt/mautrix-instagram/mauigpapi/http/thread.py", line 152, in broadcast
return await self._broadcast(
File "/opt/mautrix-instagram/mauigpapi/http/thread.py", line 137, in _broadcast
return await self.std_http_post(
File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 151, in std_http_post
json_data = await self._handle_response(resp)
File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 181, in _handle_response
await self._raise_response_error(resp)
File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 223, in _raise_response_error
raise IGResponseError(resp, data)
mauigpapi.errors.response.IGResponseError: Request POST /api/v1/direct_v2/threads/broadcast/configure_video/ failed: Transcode not finished yet.
Continuing with the behaviour of the facebook bridge, where we have the possibility to configure a proxy that allows us to connect to the facebook broker. All this so that the proxy has all the traffic.
Motivation:
github.com/mautrix/facebook/commit/47005568f6f31002540abbe7be3430a8a4fa3f82
I gave this bridge a try. However, when someone sends a private message, nothing happens with the current latest version. Instead, the log shows the following exception:
instagram_1 | [2021-03-16 20:06:09,379] [[email protected].@languitar:matrix.semipol.de] Error in incoming MQTT message handler
instagram_1 | Traceback (most recent call last):
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix/types/util/serializable_attrs.py", line 131, in _dict_to_attrs
instagram_1 | obj = attrs_type(**new_items)
instagram_1 | TypeError: __init__() missing 1 required keyword-only argument: 'last_seen_at'
instagram_1 |
instagram_1 | The above exception was the direct cause of the following exception:
instagram_1 |
instagram_1 | Traceback (most recent call last):
instagram_1 | File "/opt/mautrix-instagram/mauigpapi/mqtt/conn.py", line 349, in _on_message_handler
instagram_1 | self._on_message_sync(message.payload)
instagram_1 | File "/opt/mautrix-instagram/mauigpapi/mqtt/conn.py", line 292, in _on_message_sync
instagram_1 | self._on_messager_sync_item(part, parsed_item)
instagram_1 | File "/opt/mautrix-instagram/mauigpapi/mqtt/conn.py", line 276, in _on_messager_sync_item
instagram_1 | evt = ThreadSyncEvent.deserialize(raw_message)
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix/types/util/serializable_attrs.py", line 297, in deserialize
instagram_1 | return _dict_to_attrs(cls, data)
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix/types/util/serializable_attrs.py", line 137, in _dict_to_attrs
instagram_1 | raise SerializerError("Missing value for required key "
instagram_1 | mautrix.types.util.serializable.SerializerError: Missing value for required key last_seen_at in ThreadSyncEvent
"Image": "sha256:6127f7fb2bb797ba8f702ac219809593ecda688012229c58da37cc3e774a81ae"
On Instagram voice messages are limited to 59s. When sending a longer on matrix it is not transmitted.
Possible solutions are to send a message on the chat informing that it was too long to transmit. Or divide the voice message into several parts.
Every time I connect somewhere else (my phone or computer), I get disconnected on matrix, the opposite is true as well.
The bot is throwing
You have been logged out of Instagram: You've Been Logged Out (reason code: 7)
You have been logged out of Instagram: You've Been Logged Out (reason code: 8)
Error in listener: Server refused connection with error code 5
In the conversations I get Your message was not bridged: Sending message failed: ThreadUserIdDoesNotExist: request failed to authenticate user
I've tried changing my password but it keeps happening, am I the only one ? Is this something from instagram directly ?
Hi,
I just wanted to setup the encryption of the bridge but somehow I receive the fallowing error in the log
[2023-09-18 17:33:31,761] [[email protected]] 172.23.0.2 [18/Sep/2023:17:33:31 +0000] "PUT /_matrix/app/v1/transactions/1292 HTTP/1.1" 200 159 "-" "Synapse/1.92.2"
[2023-09-18 17:33:31,895] [[email protected]] Sync request errored: MUnknown: Internal server error, waiting 10 seconds before continuing
[2023-09-18 17:33:33,020] [[email protected]] Handling transaction 1293 with 1 EDUs
[2023-09-18 17:33:33,020] [[email protected]] Finished handling transaction 1293
...
[2023-09-18 17:33:43,435] [[email protected]] Couldn't find session RG7lH6xFRTdL1yp99mHYmvodKs024suPyFoYSb+XEo8 trying to decrypt $FPCsDnkZd9e6zkm_PqxYGt8r1Kn2GzH8SxWmrevSAE8, waiting 3 seconds...
[2023-09-18 17:33:46,439] [[email protected]] Couldn't find session RG7lH6xFRTdL1yp99mHYmvodKs024suPyFoYSb+XEo8 trying to decrypt $FPCsDnkZd9e6zkm_PqxYGt8r1Kn2GzH8SxWmrevSAE8, waiting even longer
Does anyone has an idea on how to fix this?
Thank you
How does this bridge receive messages from IG without any published endpoint?
I tried running this bridge on my development machine using docker. But without any published endpoint, it's able to receive messages from IG. I'm wondering how it's done.
Logs:
2021-06-26 21:45:39,668] [[email protected]] Failed to deserialize {'pk': 4236812322, 'username': 'elonrmuskk', 'full_name': 'Elon Musk Now', 'is_private': False, 'profile_pic_url': 'https://instagram.fbom26-1.fna.fbcdn.net/v/t51.2885-19/s150x150/44329317_268583430479565_454483638147350528_n.jpg?tp=1&_nc_ht=instagram.fbom26-1.fna.fbcdn.net&_nc_ohc=VmWI97mTacMAX9iRTzq&edm=AM7KJZYBAAAA&ccb=7-4&oh=661e5a7dbf5156beec1a356c319fba3b&oe=60DE6270&_nc_sid=d96ff1', 'profile_pic_id': '1921356713098066787_4236812322', 'is_verified': False, 'follow_friction_type': 0, 'has_anonymous_profile_picture': False, 'account_badges': [], 'social_context': 'Followed by redacted', 'search_social_context': 'Followed by redacted', 'friendship_status': {'following': False, 'is_private': False, 'incoming_request': False, 'outgoing_request': False, 'is_bestie': False, 'is_restricted': False}, 'latest_reel_media': 0, 'live_broadcast_id': None} into SearchResultUser
[2021-06-26 21:45:39,669] [[email protected]] Unhandled error while handling command search elonmusk from @kavin:kavin.rocks (ref: 1624743909)
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 188, in _dict_to_attrs
obj = attrs_type(**new_items)
TypeError: __init__() missing 1 required positional argument: 'mutual_followers_count'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/mautrix/bridge/commands/handler.py", line 406, in handle
await self._run_handler(handler, evt)
File "/usr/lib/python3.9/site-packages/mautrix/bridge/commands/handler.py", line 291, in __call__
return await self._handler(evt)
File "/usr/lib/python3.9/site-packages/mautrix_instagram/commands/misc.py", line 30, in search
resp = await evt.sender.client.search_users(" ".join(evt.args))
File "/opt/mautrix-instagram/mauigpapi/http/user.py", line 27, in search_users
return await self.std_http_get("/api/v1/users/search/", query=req,
File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 138, in std_http_get
return response_type.deserialize(json_data)
File "/usr/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 349, in deserialize
return _dict_to_attrs(cls, data)
File "/usr/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 176, in _dict_to_attrs
new_items[name] = _try_deserialize(field, value)
File "/usr/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 204, in _try_deserialize
return _deserialize(field.type, value, field.default)
File "/usr/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 255, in _deserialize
return [_deserialize(item_cls, item) for item in value]
File "/usr/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 255, in <listcomp>
return [_deserialize(item_cls, item) for item in value]
File "/usr/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 242, in _deserialize
return _dict_to_attrs(cls, value, default, default_if_empty=True)
File "/usr/lib/python3.9/site-packages/mautrix/types/util/serializable_attrs.py", line 194, in _dict_to_attrs
raise SerializerError("Missing value for required key "
mautrix.types.util.serializable.SerializerError: Missing value for required key mutual_followers_count in SearchResultUser
Hi,
I recently ran this script
https://github.com/mautrix/instagram/blob/master/mauigpapi/scripts/iglogin.py and was able to get the state in JSON.
How do I use this state on subsequent requests so I don't have to re login?
Same problem as in #43 but I can't reopen it
Bridges are updated weekly so I guess I'm on 0.2.3
when I send a message to instagram user from Matrix, it throws error:
Traceback (most recent call last):
File "/servers/InstagramBridge/lib/python3.8/site-packages/mautrix/appservice/api/intent.py", line 335, in ensure_joined
await self.join_room(room_id, max_retries=0)
File "/servers/InstagramBridge/lib/python3.8/site-packages/mautrix/appservice/api/intent.py", line 83, in wrapper
return await __method(*args, **kwargs)
File "/servers/InstagramBridge/lib/python3.8/site-packages/mautrix/client/api/rooms.py", line 252, in join_room
content = await self.api.request(Method.POST, Path.join[room_id_or_alias],
File "/servers/InstagramBridge/lib/python3.8/site-packages/mautrix/api.py", line 254, in request
return await self._send(method, full_url, content, query_params, headers or {})
File "/servers/InstagramBridge/lib/python3.8/site-packages/mautrix/api.py", line 177, in _send
raise make_request_error(http_status=response.status,
mautrix.errors.request.MForbidden: You are not invited to this room.
if I add instagram-bot to this private conversation manually, then it forwards instagram -> matrix messages, but matrix -> instagram, it says:
[2021-04-24 16:46:17,349] [[email protected]] Received Matrix event redacted from @redacted in redacted
[2021-04-24 16:46:17,350] [[email protected]] Handling Matrix message redacted from redacted
[2021-04-24 16:46:17,551] [[email protected]] Handled Matrix message redacted -> redacted
[2021-04-24 16:46:17,608] [[email protected]] Ignoring message redacted by redacted as it was already handled (message.id in dedup queue)
if I understood correctly, due to unknown reason it is treating every my message as a duplicate, thus not sending it
When trying to login into instagram, the connection is ok but i have this error in log :
Exception while syncing Traceback (most recent call last): File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/types/util/serializable_attrs.py", line 117, in _dict_to_attrs obj = attrs_type(**new_items) TypeError: __init__() missing 1 required keyword-only argument: 'inviter'
`
A normal login process
When I try to type login myusername mypassword
, I get in return as a answer from the bot:
Unhandled error while handling command:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/mautrix/bridge/commands/handler.py", line 405, in handle
await self._run_handler(handler, evt)
File "/usr/lib/python3.8/site-packages/mautrix/bridge/commands/handler.py", line 290, in __call__
return await self._handler(evt)
File "/usr/lib/python3.8/site-packages/mautrix_instagram/commands/auth.py", line 66, in login
api, state = await get_login_state(evt.sender, username, evt.config["instagram.device_seed"])
File "/usr/lib/python3.8/site-packages/mautrix_instagram/commands/auth.py", line 46, in get_login_state
await api.qe_sync_login_experiments()
File "/opt/mautrix-instagram/mauigpapi/http/qe.py", line 26, in qe_sync_login_experiments
return await self.__sync(self.state.application.LOGIN_EXPERIMENTS)
File "/opt/mautrix-instagram/mauigpapi/http/qe.py", line 41, in __sync
resp = await self.std_http_post("/api/v1/qe/sync/", data=req, response_type=QeSyncResponse)
File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 121, in std_http_post
json_data = await self._handle_response(resp)
File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 143, in _handle_response
body = await resp.json()
File "/usr/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1097, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://i.instagram.com/accounts/login/')
Googling this exact error, I got a few interesting responses:
Any ideas what could be causing this?
I was trying to log in (my account has 2fa if that makes a difference) and I get this exception.
instagram_1 | [2021-03-25 19:00:28,672] [[email protected]] Failed to deserialize {'mode': 0, 'emoji': '๐', 'emoji_color': '-14145496', 'selfie_sticker': '0'} into LoginResponseNametag
instagram_1 | [2021-03-25 19:00:28,672] [[email protected]] Failed to log in
instagram_1 | Traceback (most recent call last):
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix/types/util/serializable_attrs.py", line 131, in _dict_to_attrs
instagram_1 | obj = attrs_type(**new_items)
instagram_1 | TypeError: __init__() missing 1 required positional argument: 'gradient'
instagram_1 |
instagram_1 | The above exception was the direct cause of the following exception:
instagram_1 |
instagram_1 | Traceback (most recent call last):
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix_instagram/commands/auth.py", line 68, in login
instagram_1 | resp = await api.login(username, password)
instagram_1 | File "/opt/mautrix-instagram/mauigpapi/http/login.py", line 53, in login
instagram_1 | return await self.std_http_post("/api/v1/accounts/login/", data=req,
instagram_1 | File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 123, in std_http_post
instagram_1 | return response_type.deserialize(json_data)
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix/types/util/serializable_attrs.py", line 297, in deserialize
instagram_1 | return _dict_to_attrs(cls, data)
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix/types/util/serializable_attrs.py", line 118, in _dict_to_attrs
instagram_1 | new_items[name] = _try_deserialize(field.type, value, field.default,
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix/types/util/serializable_attrs.py", line 148, in _try_deserialize
instagram_1 | return _deserialize(cls, value, default)
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix/types/util/serializable_attrs.py", line 185, in _deserialize
instagram_1 | return _dict_to_attrs(cls, value, default, default_if_empty=True)
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix/types/util/serializable_attrs.py", line 118, in _dict_to_attrs
instagram_1 | new_items[name] = _try_deserialize(field.type, value, field.default,
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix/types/util/serializable_attrs.py", line 148, in _try_deserialize
instagram_1 | return _deserialize(cls, value, default)
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix/types/util/serializable_attrs.py", line 185, in _deserialize
instagram_1 | return _dict_to_attrs(cls, value, default, default_if_empty=True)
instagram_1 | File "/usr/lib/python3.8/site-packages/mautrix/types/util/serializable_attrs.py", line 137, in _dict_to_attrs
instagram_1 | raise SerializerError("Missing value for required key "
instagram_1 | mautrix.types.util.serializable.SerializerError: Missing value for required key gradient in LoginResponseNametag
I installed this bridge using spantaleev's playbook.
Each time I restart the bridge (because of an upgrade or something else) I receive the same DM. This DM was sent to me from an actual Instagram account on March 27th at 13:03. Now everytime I issue a restart I get a fresh copy of it.
I don't know much about how this bridge handles stored messages and chaches. I tried removing the Docker images to see if I could make it go away, to no avail.
How can I remove the message once for all?
here is the log
Nov 22 18:20:20 server python[680955]: [2021-11-22 18:20:20,963] [[email protected]] Initializing mautrix-instagram 0.1.1+dev.a87b1a44
Nov 22 18:20:20 server python[680955]: [2021-11-22 18:20:20,965] [[email protected]] Initialization complete in 0.08 seconds
Nov 22 18:20:20 server python[680955]: [2021-11-22 18:20:20,965] [[email protected]] Running startup actions...
Nov 22 18:20:20 server python[680955]: [2021-11-22 18:20:20,966] [[email protected]] Connecting to postgres://instagram:[redacted]@127.0.0.1/instagram
Nov 22 18:20:20 server python[680955]: [2021-11-22 18:20:20,966] [[email protected]] Unexpected error in main event loop
Nov 22 18:20:20 server python[680955]: Traceback (most recent call last):
Nov 22 18:20:20 server python[680955]: File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix/util/program.py", line 197, in _run
Nov 22 18:20:20 server python[680955]: self.loop.run_until_complete(self.start())
Nov 22 18:20:20 server python[680955]: File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
Nov 22 18:20:20 server python[680955]: return future.result()
Nov 22 18:20:20 server python[680955]: File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix_instagram/__main__.py", line 76, in start
Nov 22 18:20:20 server python[680955]: await self.db.start()
Nov 22 18:20:20 server python[680955]: File "/opt/mautrix-instagram/lib/python3.9/site-packages/mautrix/util/async_db/asyncpg.py", line 39, in start
Nov 22 18:20:20 server python[680955]: self._pool = await asyncpg.create_pool(self.url, **self._db_args)
Nov 22 18:20:20 server python[680955]: File "/opt/mautrix-instagram/lib/python3.9/site-packages/asyncpg/pool.py", line 407, in _async__init__
Nov 22 18:20:20 server python[680955]: await self._initialize()
Nov 22 18:20:20 server python[680955]: File "/opt/mautrix-instagram/lib/python3.9/site-packages/asyncpg/pool.py", line 435, in _initialize
Nov 22 18:20:20 server python[680955]: await first_ch.connect()
Nov 22 18:20:20 server python[680955]: File "/opt/mautrix-instagram/lib/python3.9/site-packages/asyncpg/pool.py", line 127, in connect
Nov 22 18:20:20 server python[680955]: self._con = await self._pool._get_new_connection()
Nov 22 18:20:20 server python[680955]: File "/opt/mautrix-instagram/lib/python3.9/site-packages/asyncpg/pool.py", line 477, in _get_new_connection
Nov 22 18:20:20 server python[680955]: con = await connection.connect(
Nov 22 18:20:20 server python[680955]: File "/opt/mautrix-instagram/lib/python3.9/site-packages/asyncpg/connection.py", line 1981, in connect
Nov 22 18:20:20 server python[680955]: return await connect_utils._connect(
Nov 22 18:20:20 server python[680955]: File "/opt/mautrix-instagram/lib/python3.9/site-packages/asyncpg/connect_utils.py", line 725, in _connect
Nov 22 18:20:20 server python[680955]: addrs, params, config = _parse_connect_arguments(timeout=timeout, **kwargs)
Nov 22 18:20:20 server python[680955]: File "/opt/mautrix-instagram/lib/python3.9/site-packages/asyncpg/connect_utils.py", line 491, in _parse_connect_arguments
Nov 22 18:20:20 server python[680955]: addrs, params = _parse_connect_dsn_and_args(
Nov 22 18:20:20 server python[680955]: File "/opt/mautrix-instagram/lib/python3.9/site-packages/asyncpg/connect_utils.py", line 253, in _parse_connect_dsn_and_args
Nov 22 18:20:20 server python[680955]: host, port = _parse_hostlist(dsn_hostspec, port, unquote=True)
Nov 22 18:20:20 server python[680955]: File "/opt/mautrix-instagram/lib/python3.9/site-packages/asyncpg/connect_utils.py", line 213, in _parse_hostlist
Nov 22 18:20:20 server python[680955]: hostlist_ports.append(int(hostspec_port))
Nov 22 18:20:20 server python[680955]: ValueError: invalid literal for int() with base 10: '!2'
Nov 22 18:20:21 server systemd[1]: mautrix-instagram.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 22 18:20:21 server systemd[1]: mautrix-instagram.service: Failed with result 'exit-code'.
lines 31-73/73 (END)
~~~
after installing the bridge i ran login x y
with x=username and y=password
bridge responds with Failed to log in: Request POST /api/v1/accounts/login/ failed: Sorry, there was a problem with your request.
python error looks like there is a problem communicating with the api:
[2021-12-28 15:29:11,935] [[email protected]] Failed to log in
Traceback (most recent call last):
File "/opt/mautrix-instagram/lib/python3.8/site-packages/mautrix_instagram/commands/auth.py", line 68, in login
resp = await api.login(username, password)
File "/opt/mautrix-instagram/lib/python3.8/site-packages/mauigpapi/http/login.py", line 53, in login
return await self.std_http_post("/api/v1/accounts/login/", data=req,
File "/opt/mautrix-instagram/lib/python3.8/site-packages/mauigpapi/http/base.py", line 121, in std_http_post
json_data = await self._handle_response(resp)
File "/opt/mautrix-instagram/lib/python3.8/site-packages/mauigpapi/http/base.py", line 147, in _handle_response
await self._raise_response_error(resp)
File "/opt/mautrix-instagram/lib/python3.8/site-packages/mauigpapi/http/base.py", line 190, in _raise_response_error
raise IGResponseError(resp, data)
i checked the client response variable in
instagram/mauigpapi/http/base.py
Line 189 in 7bf79ba
<ClientResponse(https://i.instagram.com/api/v1/accounts/login/) [403 Forbidden]>
i guess instagram changed their api.
does anybody have the same issue?
thanks!
Hello,
When login to Instagram fails, username and password are in plain text in the error log.
[2021-01-03 18:59:02,516] [[email protected]] Unhandled error while handling command login <USERNAME> <PASSWORD> from @MXID (ref: 1609694942)
Traceback (most recent call last):
File "/opt/mautrix-instagram/lib/python3.8/site-packages/mautrix/bridge/commands/handler.py", line 405, in handle
await self._run_handler(handler, evt)
File "/opt/mautrix-instagram/lib/python3.8/site-packages/mautrix/bridge/commands/handler.py", line 290, in __call__
return await self._handler(evt)
File "/opt/mautrix-instagram/lib/python3.8/site-packages/mautrix_instagram/commands/auth.py", line 68, in login
resp = await api.login(username, password)
File "/opt/mautrix-instagram/lib/python3.8/site-packages/mauigpapi/http/login.py", line 53, in login
return await self.std_http_post("/api/v1/accounts/login/", data=req,
File "/opt/mautrix-instagram/lib/python3.8/site-packages/mauigpapi/http/base.py", line 121, in std_http_post
json_data = await self._handle_response(resp)
File "/opt/mautrix-instagram/lib/python3.8/site-packages/mauigpapi/http/base.py", line 147, in _handle_response
await self._raise_response_error(resp)
File "/opt/mautrix-instagram/lib/python3.8/site-packages/mauigpapi/http/base.py", line 162, in _raise_response_error
raise IGRateLimitError(resp, data)
mauigpapi.errors.response.IGRateLimitError: Request POST /api/v1/accounts/login/ failed: Please wait a few minutes before you try again.
This information should not be visible at any time to third parties (not even server admins)
Anyway, thanks for your bridge and the maintenance of it.
Kind Regards
Stefan
As the title says, when receiving voice messages now, it always says "Attachment not available: failed to copy file" and I can't hear it (obviously), wasn't always like this.
Using Element web & android
from what I can tell i'm using 0.2.2 so the latest
When backfilling chats, the first messages are duplicated. The exact number of duplications varies, I counted between 6 and 9 times the same messages. The number of messages duplicated also varies, I counted 3-6. All chats with duplicates have more than 5 messages, all chats without have less than 5 messages. This didn't occur yesterday with bride version mautrix-instagram 0.2.3+dev.6556cbb7
.
I cleared the cache of Element Desktop (Windows) and also verified the existente of the duplicate messages in Element Android.
current bridge version: mautrix-instagram 0.2.3+dev.6f40e012
.
I'm not sure what to search for in the logs, please tell me what information you need :)
Relevant config:
max_startup_thread_sync_count: 40
backfill:
enable: true
msc2716: true
double_puppet_backfill: false
max_conversations: -1
min_sync_thread_delay: 5
unread_hours_threshold: 0
backoff:
thread_list: 300
message_history: 300
incremental:
max_pages: 10
max_total_pages: -1
page_delay: 5
post_batch_delay: 20
Hey there, mautrix-instagram is a wonderful tool, I'm really happy with it.
Recently (in the past couple days) Instagram has been telling me that there is 'suspicious activity' on my account; it's definitely correlated with connecting this bridge. I'm guessing maybe the bridge is communicating with Instagram in some way that sets off its suspicious activity detection mechanisms or something?
Has anyone seen this before? Any suggestions on how one might fix it? (I'm happy to get my hands dirty, just not quite sure where I might start debugging this one.)
For about 18 hours now, the bridge (dock.mau.dev/mautrix/instagram:latest, pulled about an hour ago) fails to properly connect. It starts normally, upon logging in it reports success but a subsequent ping tells me I'm not actually logged in.
The log contains the following error:
[2022-10-05 09:32:06,754] [[email protected].@redacted] Error while connecting to Instagram
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/mautrix/types/util/serializable_attrs.py", line 212, in _dict_to_attrs
obj = attrs_type(**new_items)
TypeError: CurrentUser.__init__() missing 1 required keyword-only argument: 'biography_product_mentions'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/mautrix_instagram/user.py", line 181, in try_connect
await self.connect()
File "/usr/lib/python3.10/site-packages/mautrix_instagram/user.py", line 204, in connect
resp = await client.current_user()
File "/opt/mautrix-instagram/mauigpapi/http/account.py", line 29, in current_user
return await self.std_http_get(
File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 177, in std_http_get
return response_type.deserialize(json_data)
File "/usr/lib/python3.10/site-packages/mautrix/types/util/serializable_attrs.py", line 375, in deserialize
return _dict_to_attrs(cls, data)
File "/usr/lib/python3.10/site-packages/mautrix/types/util/serializable_attrs.py", line 198, in _dict_to_attrs
new_items[name] = _try_deserialize(field_meta, value)
File "/usr/lib/python3.10/site-packages/mautrix/types/util/serializable_attrs.py", line 229, in _try_deserialize
return _deserialize(field.type, value, field.default)
File "/usr/lib/python3.10/site-packages/mautrix/types/util/serializable_attrs.py", line 267, in _deserialize
return _dict_to_attrs(cls, value, default, default_if_empty=True)
File "/usr/lib/python3.10/site-packages/mautrix/types/util/serializable_attrs.py", line 218, in _dict_to_attrs
raise SerializerError(
mautrix.types.util.serializable.SerializerError: Missing value for required key biography_product_mentions in CurrentUser
1:1 chats do not receive messages after a set period of time, 1-2 days and causes me to have to either restart or run the refresh
command.
I don't have logs right now but I'm afraid those would leak any info (as I don't exactly know when it happens and that would result in having to share my whole log)
Hi Guys, first of all thank you very much for this awesome possibility and the awesome software!
Is there any opportuniy to use more than one instagram-account? I want to use one private and one business-account to bridge to matrix.
Backfilled messages use a puppet to mimic the linked account posting messages, but this is not the case when the bot is live running.
Any message sent from instagram fail with the following error:
Nov 25 07:20:45 mathilda python[4435]: [2021-11-25 07:20:45,020] [[email protected]] Fatal error handling Instagram item
Nov 25 07:20:45 mathilda python[4435]: Traceback (most recent call last):
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 350, in ensure_joined
Nov 25 07:20:45 mathilda python[4435]: await self.join_room(room_id, max_retries=0)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 83, in wrapper
Nov 25 07:20:45 mathilda python[4435]: return await __method(*args, **kwargs)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/client/api/rooms.py", line 270, in join_room
Nov 25 07:20:45 mathilda python[4435]: content=content, query_params=query_params)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/api.py", line 299, in request
Nov 25 07:20:45 mathilda python[4435]: return await self._send(method, full_url, content, query_params, headers or {})
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/api.py", line 221, in _send
Nov 25 07:20:45 mathilda python[4435]: errcode=errcode, message=message)
Nov 25 07:20:45 mathilda python[4435]: mautrix.errors.request.MForbidden: You are not invited to this room.
Nov 25 07:20:45 mathilda python[4435]: During handling of the above exception, another exception occurred:
Nov 25 07:20:45 mathilda python[4435]: Traceback (most recent call last):
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 350, in ensure_joined
Nov 25 07:20:45 mathilda python[4435]: await self.join_room(room_id, max_retries=0)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 83, in wrapper
Nov 25 07:20:45 mathilda python[4435]: return await __method(*args, **kwargs)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/client/api/rooms.py", line 270, in join_room
Nov 25 07:20:45 mathilda python[4435]: content=content, query_params=query_params)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/api.py", line 299, in request
Nov 25 07:20:45 mathilda python[4435]: return await self._send(method, full_url, content, query_params, headers or {})
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/api.py", line 221, in _send
Nov 25 07:20:45 mathilda python[4435]: errcode=errcode, message=message)
Nov 25 07:20:45 mathilda python[4435]: mautrix.errors.request.MForbidden: You are not invited to this room.
Nov 25 07:20:45 mathilda python[4435]: The above exception was the direct cause of the following exception:
Nov 25 07:20:45 mathilda python[4435]: Traceback (most recent call last):
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix_instagram/portal.py", line 673, in handle_instagram_item
Nov 25 07:20:45 mathilda python[4435]: await self._handle_instagram_item(source, sender, item, is_backfill)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix_instagram/portal.py", line 758, in _handle_instagram_item
Nov 25 07:20:45 mathilda python[4435]: event_id = await self._handle_instagram_text(intent, item, item.text)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix_instagram/portal.py", line 635, in _handle_instagram_text
Nov 25 07:20:45 mathilda python[4435]: return await self._send_message(intent, content, timestamp=item.timestamp // 1000)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/bridge/portal.py", line 80, in _send_message
Nov 25 07:20:45 mathilda python[4435]: return await intent.send_message_event(self.mxid, event_type, content, **kwargs)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 94, in wrapper
Nov 25 07:20:45 mathilda python[4435]: await __self.ensure_joined(room_id)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 356, in ensure_joined
Nov 25 07:20:45 mathilda python[4435]: await bot.invite_user(room_id, self.mxid)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 94, in wrapper
Nov 25 07:20:45 mathilda python[4435]: await __self.ensure_joined(room_id)
Nov 25 07:20:45 mathilda python[4435]: File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 354, in ensure_joined
Nov 25 07:20:45 mathilda python[4435]: raise IntentError(f"Failed to join room {room_id} as {self.mxid}") from e
Nov 25 07:20:45 mathilda python[4435]: mautrix.errors.base.IntentError: Failed to join room !pPRsTtrCYqdmBgtlzy:server.com as @instagrambot:serveur.com
Expected behavior: A puppet is invited, transmit the message then leaves. This may be related to #15.
Hello, thanks for the great work on this project!
When I enable relaying in a chat and a bot sends a message, the bot crashes with the following error:
[2022-01-06 12:25:35,090] [[email protected]] Handling Matrix message $xxx from @xxx with request ID xxx
[2022-01-06 12:25:35,090] [[email protected]] Fatal error handling Matrix event $xxx: Unknown message type m.notice
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/mautrix_instagram/portal.py", line 196, in handle_matrix_message
await self._handle_matrix_message(sender, message, event_id)
File "/usr/lib/python3.9/site-packages/mautrix_instagram/portal.py", line 332, in _handle_matrix_message
raise NotImplementedError(f"Unknown message type {message.msgtype}")
NotImplementedError: Unknown message type m.notice
Description of messages with type NOTICE:
A m.notice message should be considered similar to a plain m.text message except that clients should visually distinguish it in some way. It is intended to be used by automated clients, such as bots, bridges, and other entities, rather than humans. Additionally, such automated agents which watch a room for messages and respond to them ought to ignore m.notice messages. This helps to prevent infinite-loop situations where two automated clients continuously exchange messages, as each responds to the other.
https://matrix.org/docs/spec/r0.0.0/client_server#m-notice
This makes it sound like it can just be treated like normal messages (TEXT) when it comes to forwarding those messages to Instagram.
When trying to login to the bridge it says successfully logged in, gets my name and instagram sends me an email saying a new device has logged in but ping
tells me MQTT not connected. Running connect
gives this:
Traceback (most recent call last):
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/types/util/serializable_attrs.py", line 194, in _dict_to_attrs
obj = attrs_type(**new_items)
TypeError: __init__() missing 1 required keyword-only argument: 'is_pin'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/bridge/commands/handler.py", line 409, in handle
await self._run_handler(handler, evt)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/bridge/commands/handler.py", line 296, in __call__
return await self._handler(evt)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix_instagram/commands/conn.py", line 70, in connect
await evt.sender.refresh(resync=False)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix_instagram/user.py", line 255, in refresh
await self.start_listen()
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix_instagram/user.py", line 295, in start_listen
resp = await self.client.get_inbox(limit=1)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mauigpapi/http/thread.py", line 39, in get_inbox
response_type=DMInboxResponse)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mauigpapi/http/base.py", line 138, in std_http_get
return response_type.deserialize(json_data)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/types/util/serializable_attrs.py", line 354, in deserialize
return _dict_to_attrs(cls, data)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/types/util/serializable_attrs.py", line 182, in _dict_to_attrs
new_items[name] = _try_deserialize(field_meta, value)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/types/util/serializable_attrs.py", line 210, in _try_deserialize
return _deserialize(field.type, value, field.default)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/types/util/serializable_attrs.py", line 248, in _deserialize
return _dict_to_attrs(cls, value, default, default_if_empty=True)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/types/util/serializable_attrs.py", line 182, in _dict_to_attrs
new_items[name] = _try_deserialize(field_meta, value)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/types/util/serializable_attrs.py", line 210, in _try_deserialize
return _deserialize(field.type, value, field.default)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/types/util/serializable_attrs.py", line 261, in _deserialize
return [_deserialize(item_cls, item) for item in value]
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/types/util/serializable_attrs.py", line 261, in <listcomp>
return [_deserialize(item_cls, item) for item in value]
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/types/util/serializable_attrs.py", line 248, in _deserialize
return _dict_to_attrs(cls, value, default, default_if_empty=True)
File "/opt/mautrix-instagram/lib/python3.7/site-packages/mautrix/types/util/serializable_attrs.py", line 201, in _dict_to_attrs
f"{json_key} in {attrs_type.__name__}") from e
mautrix.types.util.serializable.SerializerError: Missing value for required key is_pin in Thread
The same error appeared in the bridge log when initially logging in but wasn't reported in the management room.
I installed the bridge yesterday and just noticed that the "seen by" data is inconsistent with Instagram's own app, often showing users as having not seen the message when the Instagram app says they have.
For example, I sent a message using the bridge, and Element shows that no users have seen it (it's just the checkmark circle, and all the mini profile photos are further up in the timeline) - but in the Instagram app, it says that users have seen the message.
Not sure if this is an issue with my install or the bridge, and if I'm honest I'm not sure how to check. I installed it using the instructions at https://github.com/beeper/self-host/blob/main/README.md on a VPS. If you need any more info, let me know :)
This is a peculiar one and I'm not sure if it's my config, but there's almost always one conversation in Instagram that just won't sync properly and I've been struggling to get to the bottom of it.
I can see the bridge is creating the room and setting the right invites, etc:
[2023-09-02 11:12:19,159] [[email protected]] Matrix room created: !VYCGPuPaXrSkEwnmHR:tcpip.uk
[2023-09-02 11:12:19,167] [[email protected].@instagram_506211844:tcpip.uk] req #180: PUT http://nginx:8008/_matrix/client/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/state/m.room.member/%40tom%3Atcpip.uk?user_id=@instagram_506211844:tcpip.uk {"membership": "invite", "avatar_url": "mxc://tcpip.uk/RaMqxgxIZUuDUaHZSKYvWkoK", "displayname": "Tom Black", "is_direct": true, "fi.mau.will_auto_accept": true}
[2023-09-02 11:12:19,265] [[email protected].@instagram_506211844:tcpip.uk] req #180 (/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/state/m.room.member/%40tom%3Atcpip.uk) completed in 98.0ms with status 200
[2023-09-02 11:12:19,274] [[email protected].@tom:tcpip.uk] req #181: PUT http://nginx:8008/_matrix/client/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/state/m.room.member/%40tom%3Atcpip.uk {"membership": "join", "avatar_url": "mxc://tcpip.uk/RaMqxgxIZUuDUaHZSKYvWkoK", "displayname": "Tom Black", "is_direct": false, "fi.mau.double_puppet_source": "mautrix-instagram"}
[2023-09-02 11:12:19,363] [[email protected].@tom:tcpip.uk] req #181 (/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/state/m.room.member/%40tom%3Atcpip.uk) completed in 88.3ms with status 200
[2023-09-02 11:12:19,369] [[email protected].@instagram_506211844:tcpip.uk] req #183: GET http://nginx:8008/_matrix/client/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/joined_members?user_id=@instagram_506211844:tcpip.uk None
[2023-09-02 11:12:19,377] [[email protected].@instagram_506211844:tcpip.uk] req #183 (/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/joined_members) completed in 7.5ms with status 200
[2023-09-02 11:12:19,385] [[email protected].@instagram_506211844:tcpip.uk] req #184: PUT http://nginx:8008/_matrix/client/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/send/fi.mau.dummy.portal_created/mautrix-python_1693653139385739144_2?user_id=@instagram_506211844:tcpip.uk {}
[2023-09-02 11:12:19,440] [[email protected].@instagram_506211844:tcpip.uk] req #184 (/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/send/fi.mau.dummy.portal_created/mautrix-python_1693653139385739144_2) completed in 54.5ms with status 200
Then when it tries to actually add messages to the portal, it gets 403s and fails, repeatedly trying the same thing:
[2023-09-02 11:12:20,077] [[email protected].@instagram_506211844:tcpip.uk] req #187 (/_matrix/media/v3/upload) completed in 45.8ms with status 200
[2023-09-02 11:12:20,077] [[email protected]] Sending 14 new messages to !VYCGPuPaXrSkEwnmHR:tcpip.uk with batch ID None and previous event ID $Ono9I92-TVGu2k1NCpTCwf7uYSfROtF5E90eQYkckZg
[2023-09-02 11:12:20,078] [[email protected].@instagram_30592806:tcpip.uk] req #188: POST http://nginx:8008/_matrix/client/v3/join/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk?user_id=@instagram_30592806:tcpip.uk {}
[2023-09-02 11:12:20,123] [[email protected].@instagram_30592806:tcpip.uk] req #188 (/v3/join/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk) completed in 44.5ms with status 403
[2023-09-02 11:12:20,125] [[email protected]] req #189: POST http://nginx:8008/_matrix/client/v3/join/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk?user_id=@instagrambot:tcpip.uk {}
[2023-09-02 11:12:20,142] [[email protected]] req #189 (/v3/join/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk) completed in 17.7ms with status 403
[2023-09-02 11:12:20,143] [[email protected].@tom:tcpip.uk] Failed to sync threads. Waiting 30 seconds before retrying sync.
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 592, in ensure_joined
await self.join_room(room_id, max_retries=0)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 128, in wrapper
return await __method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/client/store_updater.py", line 62, in join_room
room_id = await super().join_room(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/client/api/rooms.py", line 335, in join_room
content = await self.api.request(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 395, in request
resp_data, resp = await self._send(
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 250, in _send
raise make_request_error(
mautrix.errors.request.MForbidden: You are not invited to this room.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 592, in ensure_joined
await self.join_room(room_id, max_retries=0)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 128, in wrapper
return await __method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/client/store_updater.py", line 62, in join_room
room_id = await super().join_room(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/client/api/rooms.py", line 335, in join_room
content = await self.api.request(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 395, in request
resp_data, resp = await self._send(
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 250, in _send
raise make_request_error(
mautrix.errors.request.MForbidden: You are not invited to this room.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/mautrix_instagram/user.py", line 840, in run_with_sync_lock
await func()
File "/usr/lib/python3.11/site-packages/mautrix_instagram/user.py", line 777, in _backfill_threads
await self._sync_threads_with_delay(
File "/usr/lib/python3.11/site-packages/mautrix_instagram/user.py", line 813, in _sync_threads_with_delay
had_new_messages = await self._sync_thread(thread)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix_instagram/user.py", line 640, in _sync_thread
base_insertion_event_id = await portal.backfill_message_page(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix_instagram/portal.py", line 2424, in backfill_message_page
event_ids = [
^
File "/usr/lib/python3.11/site-packages/mautrix_instagram/portal.py", line 2425, in <listcomp>
await intent.send_message_event(
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 141, in wrapper
await __self.ensure_joined(room_id)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 598, in ensure_joined
await bot.invite_user(room_id, self.mxid)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 141, in wrapper
await __self.ensure_joined(room_id)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 596, in ensure_joined
raise IntentError(f"Failed to join room {room_id} as {self.mxid}") from e
mautrix.errors.base.IntentError: Failed to join room !VYCGPuPaXrSkEwnmHR:tcpip.uk as @instagrambot:tcpip.uk
It seems to be repeatedly trying to join when I can see the bot user already in the room - having spoken to other people using the bridge, they don't seem to have the same issue, so I'm not sure what I might be doing wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.