example-config.yaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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. # End-to-bridge encryption support options.
  200. #
  201. # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
  202. encryption:
  203. # Allow encryption, work in group chat rooms with e2ee enabled
  204. allow: false
  205. # Default to encryption, force-enable encryption in all portals the bridge creates
  206. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  207. default: false
  208. # Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data.
  209. appservice: false
  210. # Require encryption, drop any unencrypted messages.
  211. require: false
  212. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  213. # You must use a client that supports requesting keys from other users to use this feature.
  214. allow_key_sharing: false
  215. # What level of device verification should be required from users?
  216. #
  217. # Valid levels:
  218. # unverified - Send keys to all device in the room.
  219. # cross-signed-untrusted - Require valid cross-signing, but trust all cross-signing keys.
  220. # cross-signed-tofu - Require valid cross-signing, trust cross-signing keys on first use (and reject changes).
  221. # cross-signed-verified - Require valid cross-signing, plus a valid user signature from the bridge bot.
  222. # Note that creating user signatures from the bridge bot is not currently possible.
  223. # verified - Require manual per-device verification
  224. # (currently only possible by modifying the `trust` column in the `crypto_device` database table).
  225. verification_levels:
  226. # Minimum level for which the bridge should send keys to when bridging messages from Telegram to Matrix.
  227. receive: unverified
  228. # Minimum level that the bridge should accept for incoming Matrix messages.
  229. send: unverified
  230. # Minimum level that the bridge should require for accepting key requests.
  231. share: cross-signed-tofu
  232. # Options for Megolm room key rotation. These options allow you to
  233. # configure the m.room.encryption event content. See:
  234. # https://spec.matrix.org/v1.3/client-server-api/#mroomencryption for
  235. # more information about that event.
  236. rotation:
  237. # Enable custom Megolm room key rotation settings. Note that these
  238. # settings will only apply to rooms created after this option is
  239. # set.
  240. enable_custom: false
  241. # The maximum number of milliseconds a session should be used
  242. # before changing it. The Matrix spec recommends 604800000 (a week)
  243. # as the default.
  244. milliseconds: 604800000
  245. # The maximum number of messages that should be sent with a given a
  246. # session before changing it. The Matrix spec recommends 100 as the
  247. # default.
  248. messages: 100
  249. # Whether or not to explicitly set the avatar and room name for private
  250. # chat portal rooms. This will be implicitly enabled if encryption.default is true.
  251. private_chat_portal_meta: false
  252. # Whether or not the bridge should send a read receipt from the bridge bot when a message has
  253. # been sent to Instagram.
  254. delivery_receipts: false
  255. # Whether or not delivery errors should be reported as messages in the Matrix room.
  256. delivery_error_reports: false
  257. # Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
  258. message_status_events: false
  259. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  260. # This field will automatically be changed back to false after it,
  261. # except if the config file is not writable.
  262. resend_bridge_info: false
  263. # Whether or not unimportant bridge notices should be sent to the user.
  264. # (e.g. connected, disconnected but will retry)
  265. unimportant_bridge_notices: true
  266. # Disable bridge notices entirely
  267. disable_bridge_notices: false
  268. # Send captions in the same message as images. This will send data compatible with both MSC2530 and MSC3552.
  269. # This is currently not supported in most clients.
  270. caption_in_message: false
  271. # Should Matrix m.notice-type messages be bridged?
  272. bridge_notices: true
  273. # Provisioning API part of the web server for automated portal creation and fetching information.
  274. # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
  275. provisioning:
  276. # Whether or not the provisioning API should be enabled.
  277. enabled: true
  278. # The prefix to use in the provisioning API endpoints.
  279. prefix: /_matrix/provision/v1
  280. # The shared secret to authorize users of the API.
  281. # Set to "generate" to generate and save a new token.
  282. shared_secret: generate
  283. # Segment API key to enable analytics tracking for web server endpoints. Set to null to disable.
  284. segment_key: null
  285. # Optional user_id to use when sending Segment events. If null, defaults to using mxID.
  286. segment_user_id: null
  287. # The prefix for commands. Only required in non-management rooms.
  288. command_prefix: "!ig"
  289. # Permissions for using the bridge.
  290. # Permitted values:
  291. # relay - Allowed to be relayed through the bridge, no access to commands.
  292. # user - Use the bridge with puppeting.
  293. # admin - Use and administrate the bridge.
  294. # Permitted keys:
  295. # * - All Matrix users
  296. # domain - All users on that homeserver
  297. # mxid - Specific user
  298. permissions:
  299. "*": "relay"
  300. "example.com": "user"
  301. "@admin:example.com": "admin"
  302. relay:
  303. # Whether relay mode should be allowed. If allowed, `!ig set-relay` can be used to turn any
  304. # authenticated user into a relaybot for that chat.
  305. enabled: false
  306. # The formats to use when sending messages to Instagram via a relay user.
  307. #
  308. # Available variables:
  309. # $sender_displayname - The display name of the sender (e.g. Example User)
  310. # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
  311. # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
  312. # $message - The message content
  313. #
  314. # Note that Instagram doesn't support captions for images, so images won't include any indication of being relayed.
  315. message_formats:
  316. m.text: '$sender_displayname: $message'
  317. m.notice: '$sender_displayname: $message'
  318. m.emote: '* $sender_displayname $message'
  319. # Python logging configuration.
  320. #
  321. # See section 16.7.2 of the Python documentation for more info:
  322. # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
  323. logging:
  324. version: 1
  325. formatters:
  326. colored:
  327. (): mautrix_instagram.util.ColorFormatter
  328. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  329. normal:
  330. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  331. handlers:
  332. file:
  333. class: logging.handlers.RotatingFileHandler
  334. formatter: normal
  335. filename: ./mautrix-instagram.log
  336. maxBytes: 10485760
  337. backupCount: 10
  338. console:
  339. class: logging.StreamHandler
  340. formatter: colored
  341. loggers:
  342. mau:
  343. level: DEBUG
  344. mauigpapi:
  345. level: DEBUG
  346. aiohttp:
  347. level: INFO
  348. paho.mqtt:
  349. level: INFO
  350. root:
  351. level: DEBUG
  352. handlers: [file, console]