example-config.yaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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. # Whether to enable backfilling at all.
  130. #
  131. # This requires a server with MSC2716 support, which is currently an
  132. # experimental feature in synapse. It can be enabled by setting
  133. # experimental_features -> msc2716_enabled to true in homeserver.yaml.
  134. #
  135. # Note that prior to Synapse 1.49, there were some bugs with the
  136. # implementation, especially if using event persistence workers. There
  137. # are also still some issues in Synapse's federation implementation.
  138. enable: false
  139. # Use MSC2716 for backfilling? If this is disabled, backfilling only happens when syncing threads,
  140. # and the incremental settings below don't apply.
  141. #
  142. # This requires a server with MSC2716 support, which is currently an experimental feature in Synapse.
  143. # It can be enabled by setting experimental_features -> msc2716_enabled to true in homeserver.yaml.
  144. msc2716: false
  145. # Use double puppets for backfilling?
  146. # In order to use this, the double puppets must be in the appservice's user ID namespace
  147. # (because the bridge can't use the double puppet access token with batch sending).
  148. # This only affects double puppets on the local server, double puppets on other servers will never be used.
  149. double_puppet_backfill: false
  150. # The maximum number of conversations that should be synced.
  151. # Other conversations will be backfilled on demand when the start PM
  152. # provisioning endpoint is used or when a message comes in from that
  153. # chat.
  154. # If set to -1, all conversations will by synced.
  155. max_conversations: 20
  156. # The minimum amount of time to wait between syncing each thread. This
  157. # helps avoid situations where you sync too quickly.
  158. min_sync_thread_delay: 5
  159. # If this value is greater than 0, then if the conversation's last
  160. # message was more than this number of hours ago, then the conversation
  161. # will automatically be marked it as read.
  162. # Conversations that have a last message that is less than this number
  163. # of hours ago will have their unread status synced from Instagram.
  164. unread_hours_threshold: 0
  165. # Settings for how quickly to backoff when rate-limits are encountered
  166. # while backfilling.
  167. backoff:
  168. # How many seconds to wait after getting rate limited during a
  169. # thread list fetch.
  170. thread_list: 300
  171. # How many seconds to wait after getting rate limited during a
  172. # message history fetch.
  173. message_history: 300
  174. # Settings for backfills.
  175. #
  176. # During initial/incremental sync, the entirety of the thread that is
  177. # available will be backfilled. For example, on initial sync, about 20
  178. # messages are included for each thread in the thread list returned by
  179. # the server. After that, incremental backfills will be run for each of
  180. # the portals in a round-robin fashion until all portals have been
  181. # backfilled as configured below.
  182. incremental:
  183. # The maximum number of pages to backfill per batch.
  184. max_pages: 10
  185. # The maximum number of total pages to backfill per portal.
  186. # If set to -1, infinite pages will be synced.
  187. max_total_pages: -1
  188. # The number of seconds to wait between backfilling each page.
  189. page_delay: 5
  190. # The number of seconds to wait after backfilling the batch of
  191. # messages.
  192. post_batch_delay: 20
  193. periodic_reconnect:
  194. # Interval in seconds in which to automatically reconnect all users.
  195. # This can be used to automatically mitigate the bug where Instagram stops sending messages.
  196. # Set to -1 to disable periodic reconnections entirely.
  197. interval: -1
  198. # Whether or not the bridge should backfill chats when reconnecting.
  199. resync: true
  200. # Should even disconnected users be reconnected?
  201. always: false
  202. # URL to call to retrieve a proxy URL from (defaults to the http_proxy environment variable).
  203. get_proxy_api_url: null
  204. # End-to-bridge encryption support options.
  205. #
  206. # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
  207. encryption:
  208. # Allow encryption, work in group chat rooms with e2ee enabled
  209. allow: false
  210. # Default to encryption, force-enable encryption in all portals the bridge creates
  211. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  212. default: false
  213. # Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data.
  214. appservice: false
  215. # Require encryption, drop any unencrypted messages.
  216. require: false
  217. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  218. # You must use a client that supports requesting keys from other users to use this feature.
  219. allow_key_sharing: false
  220. # What level of device verification should be required from users?
  221. #
  222. # Valid levels:
  223. # unverified - Send keys to all device in the room.
  224. # cross-signed-untrusted - Require valid cross-signing, but trust all cross-signing keys.
  225. # cross-signed-tofu - Require valid cross-signing, trust cross-signing keys on first use (and reject changes).
  226. # cross-signed-verified - Require valid cross-signing, plus a valid user signature from the bridge bot.
  227. # Note that creating user signatures from the bridge bot is not currently possible.
  228. # verified - Require manual per-device verification
  229. # (currently only possible by modifying the `trust` column in the `crypto_device` database table).
  230. verification_levels:
  231. # Minimum level for which the bridge should send keys to when bridging messages from Telegram to Matrix.
  232. receive: unverified
  233. # Minimum level that the bridge should accept for incoming Matrix messages.
  234. send: unverified
  235. # Minimum level that the bridge should require for accepting key requests.
  236. share: cross-signed-tofu
  237. # Options for Megolm room key rotation. These options allow you to
  238. # configure the m.room.encryption event content. See:
  239. # https://spec.matrix.org/v1.3/client-server-api/#mroomencryption for
  240. # more information about that event.
  241. rotation:
  242. # Enable custom Megolm room key rotation settings. Note that these
  243. # settings will only apply to rooms created after this option is
  244. # set.
  245. enable_custom: false
  246. # The maximum number of milliseconds a session should be used
  247. # before changing it. The Matrix spec recommends 604800000 (a week)
  248. # as the default.
  249. milliseconds: 604800000
  250. # The maximum number of messages that should be sent with a given a
  251. # session before changing it. The Matrix spec recommends 100 as the
  252. # default.
  253. messages: 100
  254. # Whether or not to explicitly set the avatar and room name for private
  255. # chat portal rooms. This will be implicitly enabled if encryption.default is true.
  256. private_chat_portal_meta: false
  257. # Whether or not the bridge should send a read receipt from the bridge bot when a message has
  258. # been sent to Instagram.
  259. delivery_receipts: false
  260. # Whether or not delivery errors should be reported as messages in the Matrix room.
  261. delivery_error_reports: false
  262. # Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
  263. message_status_events: false
  264. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  265. # This field will automatically be changed back to false after it,
  266. # except if the config file is not writable.
  267. resend_bridge_info: false
  268. # Whether or not unimportant bridge notices should be sent to the user.
  269. # (e.g. connected, disconnected but will retry)
  270. unimportant_bridge_notices: true
  271. # Disable bridge notices entirely
  272. disable_bridge_notices: false
  273. # Send captions in the same message as images. This will send data compatible with both MSC2530 and MSC3552.
  274. # This is currently not supported in most clients.
  275. caption_in_message: false
  276. # Should Matrix m.notice-type messages be bridged?
  277. bridge_notices: true
  278. # Provisioning API part of the web server for automated portal creation and fetching information.
  279. # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
  280. provisioning:
  281. # Whether or not the provisioning API should be enabled.
  282. enabled: true
  283. # The prefix to use in the provisioning API endpoints.
  284. prefix: /_matrix/provision/v1
  285. # The shared secret to authorize users of the API.
  286. # Set to "generate" to generate and save a new token.
  287. shared_secret: generate
  288. # Segment API key to enable analytics tracking for web server endpoints. Set to null to disable.
  289. segment_key: null
  290. # The prefix for commands. Only required in non-management rooms.
  291. command_prefix: "!ig"
  292. # Permissions for using the bridge.
  293. # Permitted values:
  294. # relay - Allowed to be relayed through the bridge, no access to commands.
  295. # user - Use the bridge with puppeting.
  296. # admin - Use and administrate the bridge.
  297. # Permitted keys:
  298. # * - All Matrix users
  299. # domain - All users on that homeserver
  300. # mxid - Specific user
  301. permissions:
  302. "*": "relay"
  303. "example.com": "user"
  304. "@admin:example.com": "admin"
  305. relay:
  306. # Whether relay mode should be allowed. If allowed, `!ig set-relay` can be used to turn any
  307. # authenticated user into a relaybot for that chat.
  308. enabled: false
  309. # The formats to use when sending messages to Instagram via a relay user.
  310. #
  311. # Available variables:
  312. # $sender_displayname - The display name of the sender (e.g. Example User)
  313. # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
  314. # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
  315. # $message - The message content
  316. #
  317. # Note that Instagram doesn't support captions for images, so images won't include any indication of being relayed.
  318. message_formats:
  319. m.text: '$sender_displayname: $message'
  320. m.notice: '$sender_displayname: $message'
  321. m.emote: '* $sender_displayname $message'
  322. # Python logging configuration.
  323. #
  324. # See section 16.7.2 of the Python documentation for more info:
  325. # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
  326. logging:
  327. version: 1
  328. formatters:
  329. colored:
  330. (): mautrix_instagram.util.ColorFormatter
  331. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  332. normal:
  333. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  334. handlers:
  335. file:
  336. class: logging.handlers.RotatingFileHandler
  337. formatter: normal
  338. filename: ./mautrix-instagram.log
  339. maxBytes: 10485760
  340. backupCount: 10
  341. console:
  342. class: logging.StreamHandler
  343. formatter: colored
  344. loggers:
  345. mau:
  346. level: DEBUG
  347. mauigpapi:
  348. level: DEBUG
  349. aiohttp:
  350. level: INFO
  351. paho.mqtt:
  352. level: INFO
  353. root:
  354. level: DEBUG
  355. handlers: [file, console]