example-config.yaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. # Homeserver details
  2. homeserver:
  3. # The address that this appservice can use to connect to the homeserver.
  4. address: https://example.com
  5. # The domain of the homeserver (for MXIDs, etc).
  6. domain: example.com
  7. # Whether or not to verify the SSL certificate of the homeserver.
  8. # Only applies if address starts with https://
  9. verify_ssl: true
  10. # What software is the homeserver running?
  11. # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here.
  12. software: standard
  13. # Number of retries for all HTTP requests if the homeserver isn't reachable.
  14. http_retry_count: 4
  15. # The URL to push real-time bridge status to.
  16. # If set, the bridge will make POST requests to this URL whenever a user's Instagram MQTT connection state changes.
  17. # The bridge will use the appservice as_token to authorize requests.
  18. status_endpoint: null
  19. # Endpoint for reporting per-message status.
  20. message_send_checkpoint_endpoint: null
  21. # Whether asynchronous uploads via MSC2246 should be enabled for media.
  22. # Requires a media repo that supports MSC2246.
  23. async_media: false
  24. # Application service host/registration related details
  25. # Changing these values requires regeneration of the registration.
  26. appservice:
  27. # The address that the homeserver can use to connect to this appservice.
  28. address: http://localhost:29330
  29. # When using https:// the TLS certificate and key files for the address.
  30. tls_cert: false
  31. tls_key: false
  32. # The hostname and port where this appservice should listen.
  33. hostname: 0.0.0.0
  34. port: 29330
  35. # The maximum body size of appservice API requests (from the homeserver) in mebibytes
  36. # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
  37. max_body_size: 1
  38. # The full URI to the database. SQLite and Postgres are supported.
  39. # Format examples:
  40. # SQLite: sqlite:///filename.db
  41. # Postgres: postgres://username:password@hostname/dbname
  42. database: postgres://username:password@hostname/db
  43. # Additional arguments for asyncpg.create_pool() or sqlite3.connect()
  44. # https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool
  45. # https://docs.python.org/3/library/sqlite3.html#sqlite3.connect
  46. # For sqlite, min_size is used as the connection thread pool size and max_size is ignored.
  47. # Additionally, SQLite supports init_commands as an array of SQL queries to run on connect (e.g. to set PRAGMAs).
  48. database_opts:
  49. min_size: 1
  50. max_size: 10
  51. # The unique ID of this appservice.
  52. id: instagram
  53. # Username of the appservice bot.
  54. bot_username: instagrambot
  55. # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
  56. # to leave display name/avatar as-is.
  57. bot_displayname: Instagram bridge bot
  58. bot_avatar: mxc://maunium.net/JxjlbZUlCPULEeHZSwleUXQv
  59. # Whether or not to receive ephemeral events via appservice transactions.
  60. # Requires MSC2409 support (i.e. Synapse 1.22+).
  61. # You should disable bridge -> sync_with_custom_puppets when this is enabled.
  62. ephemeral_events: true
  63. # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
  64. as_token: "This value is generated when generating the registration"
  65. hs_token: "This value is generated when generating the registration"
  66. # Prometheus telemetry config. Requires prometheus-client to be installed.
  67. metrics:
  68. enabled: false
  69. listen_port: 8000
  70. # Manhole config.
  71. manhole:
  72. # Whether or not opening the manhole is allowed.
  73. enabled: false
  74. # The path for the unix socket.
  75. path: /var/tmp/mautrix-instagram.manhole
  76. # The list of UIDs who can be added to the whitelist.
  77. # If empty, any UIDs can be specified in the open-manhole command.
  78. whitelist:
  79. - 0
  80. instagram:
  81. # Seed for generating devices. This is secret because the seed is used to generate
  82. # device IDs, which can apparently be used to bypass two-factor authentication after
  83. # logging out, because Instagram is insecure.
  84. device_seed: generate
  85. # Bridge config
  86. bridge:
  87. # Localpart template of MXIDs for Instagram users.
  88. # {userid} is replaced with the user ID of the Instagram user.
  89. username_template: "instagram_{userid}"
  90. # Displayname template for Instagram users.
  91. # {displayname} is replaced with the display name of the Instagram user.
  92. # {username} is replaced with the username of the Instagram user.
  93. displayname_template: "{displayname} (Instagram)"
  94. # Displayname template for 1:1 chat portals. Same variables as displayname_template.
  95. private_chat_name_template: "{displayname}"
  96. # Displayname template for group chat portals. Only {name} is available.
  97. group_chat_name_template: "{name}"
  98. # Maximum length of displayname
  99. displayname_max_length: 100
  100. # The maximum number of conversations that should be synced when we get a
  101. # message sync error. In general, 1 page (20) is sufficient.
  102. max_startup_thread_sync_count: 20
  103. # Whether or not to use /sync to get read receipts and typing notifications
  104. # when double puppeting is enabled
  105. sync_with_custom_puppets: false
  106. # Whether or not to update the m.direct account data event when double puppeting is enabled.
  107. # Note that updating the m.direct event is not atomic (except with mautrix-asmux)
  108. # and is therefore prone to race conditions.
  109. sync_direct_chat_list: false
  110. # Allow using double puppeting from any server with a valid client .well-known file.
  111. double_puppet_allow_discovery: false
  112. # Servers to allow double puppeting from, even if double_puppet_allow_discovery is false.
  113. double_puppet_server_map:
  114. example.com: https://example.com
  115. # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
  116. #
  117. # If set, custom puppets will be enabled automatically for local users
  118. # instead of users having to find an access token and run `login-matrix`
  119. # manually.
  120. # If using this for other servers than the bridge's server,
  121. # you must also set the URL in the double_puppet_server_map.
  122. login_shared_secret_map:
  123. example.com: foo
  124. # Whether or not created rooms should have federation enabled.
  125. # If false, created portal rooms will never be federated.
  126. federate_rooms: true
  127. # Settings for backfilling messages from Instagram.
  128. backfill:
  129. # Enable initial backfill (~10 messages after creating portal)?
  130. enable_initial: true
  131. # Enable backfill queue? This is used for backfilling additional threads after the initial sync,
  132. # and when MSC2716 is enabled, to backfill message history going backwards.
  133. enable: false
  134. # Use MSC2716 for backfilling? If this is disabled, backfilling only happens when syncing threads,
  135. # and the incremental settings below don't apply.
  136. #
  137. # This requires a server with MSC2716 support, which is currently an experimental feature in Synapse.
  138. # It can be enabled by setting experimental_features -> msc2716_enabled to true in homeserver.yaml.
  139. msc2716: false
  140. # Use double puppets for backfilling?
  141. # In order to use this, the double puppets must be in the appservice's user ID namespace
  142. # (because the bridge can't use the double puppet access token with batch sending).
  143. # This only affects double puppets on the local server, double puppets on other servers will never be used.
  144. double_puppet_backfill: false
  145. # The maximum number of conversations that should be synced.
  146. # Other conversations will be backfilled on demand when the start PM
  147. # provisioning endpoint is used or when a message comes in from that
  148. # chat.
  149. # If set to -1, all conversations will by synced.
  150. max_conversations: 20
  151. # The minimum amount of time to wait between syncing each thread. This
  152. # helps avoid situations where you sync too quickly.
  153. min_sync_thread_delay: 5
  154. # If this value is greater than 0, then if the conversation's last
  155. # message was more than this number of hours ago, then the conversation
  156. # will automatically be marked it as read.
  157. # Conversations that have a last message that is less than this number
  158. # of hours ago will have their unread status synced from Instagram.
  159. unread_hours_threshold: 0
  160. # Settings for how quickly to backoff when rate-limits are encountered
  161. # while backfilling.
  162. backoff:
  163. # How many seconds to wait after getting rate limited during a
  164. # thread list fetch.
  165. thread_list: 300
  166. # How many seconds to wait after getting rate limited during a
  167. # message history fetch.
  168. message_history: 300
  169. # Settings for backfills.
  170. #
  171. # During initial/incremental sync, the entirety of the thread that is
  172. # available will be backfilled. For example, on initial sync, about 20
  173. # messages are included for each thread in the thread list returned by
  174. # the server. After that, incremental backfills will be run for each of
  175. # the portals in a round-robin fashion until all portals have been
  176. # backfilled as configured below.
  177. incremental:
  178. # The maximum number of pages to backfill per batch.
  179. max_pages: 10
  180. # The maximum number of total pages to backfill per portal.
  181. # If set to -1, infinite pages will be synced.
  182. max_total_pages: -1
  183. # The number of seconds to wait between backfilling each page.
  184. page_delay: 5
  185. # The number of seconds to wait after backfilling the batch of
  186. # messages.
  187. post_batch_delay: 20
  188. periodic_reconnect:
  189. # Interval in seconds in which to automatically reconnect all users.
  190. # This can be used to automatically mitigate the bug where Instagram stops sending messages.
  191. # Set to -1 to disable periodic reconnections entirely.
  192. interval: -1
  193. # Whether or not the bridge should backfill chats when reconnecting.
  194. resync: true
  195. # Should even disconnected users be reconnected?
  196. always: false
  197. # URL to call to retrieve a proxy URL from (defaults to the http_proxy environment variable).
  198. get_proxy_api_url: null
  199. # Whether to use proxy for downloading media from Instagram.
  200. use_proxy_for_media: true
  201. # End-to-bridge encryption support options.
  202. #
  203. # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
  204. encryption:
  205. # Allow encryption, work in group chat rooms with e2ee enabled
  206. allow: false
  207. # Default to encryption, force-enable encryption in all portals the bridge creates
  208. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  209. default: false
  210. # Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data.
  211. appservice: false
  212. # Require encryption, drop any unencrypted messages.
  213. require: false
  214. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  215. # You must use a client that supports requesting keys from other users to use this feature.
  216. allow_key_sharing: false
  217. # What level of device verification should be required from users?
  218. #
  219. # Valid levels:
  220. # unverified - Send keys to all device in the room.
  221. # cross-signed-untrusted - Require valid cross-signing, but trust all cross-signing keys.
  222. # cross-signed-tofu - Require valid cross-signing, trust cross-signing keys on first use (and reject changes).
  223. # cross-signed-verified - Require valid cross-signing, plus a valid user signature from the bridge bot.
  224. # Note that creating user signatures from the bridge bot is not currently possible.
  225. # verified - Require manual per-device verification
  226. # (currently only possible by modifying the `trust` column in the `crypto_device` database table).
  227. verification_levels:
  228. # Minimum level for which the bridge should send keys to when bridging messages from Telegram to Matrix.
  229. receive: unverified
  230. # Minimum level that the bridge should accept for incoming Matrix messages.
  231. send: unverified
  232. # Minimum level that the bridge should require for accepting key requests.
  233. share: cross-signed-tofu
  234. # Options for Megolm room key rotation. These options allow you to
  235. # configure the m.room.encryption event content. See:
  236. # https://spec.matrix.org/v1.3/client-server-api/#mroomencryption for
  237. # more information about that event.
  238. rotation:
  239. # Enable custom Megolm room key rotation settings. Note that these
  240. # settings will only apply to rooms created after this option is
  241. # set.
  242. enable_custom: false
  243. # The maximum number of milliseconds a session should be used
  244. # before changing it. The Matrix spec recommends 604800000 (a week)
  245. # as the default.
  246. milliseconds: 604800000
  247. # The maximum number of messages that should be sent with a given a
  248. # session before changing it. The Matrix spec recommends 100 as the
  249. # default.
  250. messages: 100
  251. # Whether or not to explicitly set the avatar and room name for private
  252. # chat portal rooms. This will be implicitly enabled if encryption.default is true.
  253. private_chat_portal_meta: false
  254. # Whether or not the bridge should send a read receipt from the bridge bot when a message has
  255. # been sent to Instagram.
  256. delivery_receipts: false
  257. # Whether or not delivery errors should be reported as messages in the Matrix room.
  258. delivery_error_reports: false
  259. # Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
  260. message_status_events: false
  261. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  262. # This field will automatically be changed back to false after it,
  263. # except if the config file is not writable.
  264. resend_bridge_info: false
  265. # Whether or not unimportant bridge notices should be sent to the user.
  266. # (e.g. connected, disconnected but will retry)
  267. unimportant_bridge_notices: true
  268. # Disable bridge notices entirely
  269. disable_bridge_notices: false
  270. # Send captions in the same message as images. This will send data compatible with both MSC2530 and MSC3552.
  271. # This is currently not supported in most clients.
  272. caption_in_message: false
  273. # Should Matrix m.notice-type messages be bridged?
  274. bridge_notices: true
  275. # Provisioning API part of the web server for automated portal creation and fetching information.
  276. # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
  277. provisioning:
  278. # Whether or not the provisioning API should be enabled.
  279. enabled: true
  280. # The prefix to use in the provisioning API endpoints.
  281. prefix: /_matrix/provision/v1
  282. # The shared secret to authorize users of the API.
  283. # Set to "generate" to generate and save a new token.
  284. shared_secret: generate
  285. # Segment API key to enable analytics tracking for web server endpoints. Set to null to disable.
  286. segment_key: null
  287. # Optional user_id to use when sending Segment events. If null, defaults to using mxID.
  288. segment_user_id: null
  289. # The prefix for commands. Only required in non-management rooms.
  290. command_prefix: "!ig"
  291. # Permissions for using the bridge.
  292. # Permitted values:
  293. # relay - Allowed to be relayed through the bridge, no access to commands.
  294. # user - Use the bridge with puppeting.
  295. # admin - Use and administrate the bridge.
  296. # Permitted keys:
  297. # * - All Matrix users
  298. # domain - All users on that homeserver
  299. # mxid - Specific user
  300. permissions:
  301. "*": "relay"
  302. "example.com": "user"
  303. "@admin:example.com": "admin"
  304. relay:
  305. # Whether relay mode should be allowed. If allowed, `!ig set-relay` can be used to turn any
  306. # authenticated user into a relaybot for that chat.
  307. enabled: false
  308. # The formats to use when sending messages to Instagram via a relay user.
  309. #
  310. # Available variables:
  311. # $sender_displayname - The display name of the sender (e.g. Example User)
  312. # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
  313. # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
  314. # $message - The message content
  315. #
  316. # Note that Instagram doesn't support captions for images, so images won't include any indication of being relayed.
  317. message_formats:
  318. m.text: '$sender_displayname: $message'
  319. m.notice: '$sender_displayname: $message'
  320. m.emote: '* $sender_displayname $message'
  321. # Python logging configuration.
  322. #
  323. # See section 16.7.2 of the Python documentation for more info:
  324. # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
  325. logging:
  326. version: 1
  327. formatters:
  328. colored:
  329. (): mautrix_instagram.util.ColorFormatter
  330. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  331. normal:
  332. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  333. handlers:
  334. file:
  335. class: logging.handlers.RotatingFileHandler
  336. formatter: normal
  337. filename: ./mautrix-instagram.log
  338. maxBytes: 10485760
  339. backupCount: 10
  340. console:
  341. class: logging.StreamHandler
  342. formatter: colored
  343. loggers:
  344. mau:
  345. level: DEBUG
  346. mauigpapi:
  347. level: DEBUG
  348. aiohttp:
  349. level: INFO
  350. paho.mqtt:
  351. level: INFO
  352. root:
  353. level: DEBUG
  354. handlers: [file, console]