example-config.yaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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. # Maximum number of seconds since the last activity in a chat to automatically create portals.
  101. portal_create_max_age: 259200
  102. # Maximum number of chats to fetch for startup sync
  103. chat_sync_limit: 20
  104. # Maximum number of chats to create during startup sync
  105. chat_create_limit: 10
  106. # Should the chat list be synced on startup?
  107. # If false, the bridge will try to reconnect to MQTT directly and ask the server to send missed events.
  108. resync_on_startup: true
  109. # Whether or not to use /sync to get read receipts and typing notifications
  110. # when double puppeting is enabled
  111. sync_with_custom_puppets: false
  112. # Whether or not to update the m.direct account data event when double puppeting is enabled.
  113. # Note that updating the m.direct event is not atomic (except with mautrix-asmux)
  114. # and is therefore prone to race conditions.
  115. sync_direct_chat_list: false
  116. # Allow using double puppeting from any server with a valid client .well-known file.
  117. double_puppet_allow_discovery: false
  118. # Servers to allow double puppeting from, even if double_puppet_allow_discovery is false.
  119. double_puppet_server_map:
  120. example.com: https://example.com
  121. # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
  122. #
  123. # If set, custom puppets will be enabled automatically for local users
  124. # instead of users having to find an access token and run `login-matrix`
  125. # manually.
  126. # If using this for other servers than the bridge's server,
  127. # you must also set the URL in the double_puppet_server_map.
  128. login_shared_secret_map:
  129. example.com: foo
  130. # Whether or not created rooms should have federation enabled.
  131. # If false, created portal rooms will never be federated.
  132. federate_rooms: true
  133. # Settings for backfilling messages from Instagram.
  134. backfill:
  135. # Whether or not the Instagram users of logged in Matrix users should be
  136. # invited to private chats when backfilling history from Instagram. This is
  137. # usually needed to prevent rate limits and to allow timestamp massaging.
  138. invite_own_puppet: true
  139. # Maximum number of messages to backfill initially.
  140. # Set to 0 to disable backfilling when creating portal.
  141. initial_limit: 0
  142. # Maximum number of messages to backfill if messages were missed while
  143. # the bridge was disconnected.
  144. # Set to 0 to disable backfilling missed messages.
  145. missed_limit: 1000
  146. # If using double puppeting, should notifications be disabled
  147. # while the initial backfill is in progress?
  148. disable_notifications: false
  149. periodic_reconnect:
  150. # Interval in seconds in which to automatically reconnect all users.
  151. # This can be used to automatically mitigate the bug where Instagram stops sending messages.
  152. # Set to -1 to disable periodic reconnections entirely.
  153. interval: -1
  154. # Whether or not the bridge should backfill chats when reconnecting.
  155. resync: true
  156. # Should even disconnected users be reconnected?
  157. always: false
  158. # End-to-bridge encryption support options.
  159. #
  160. # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
  161. encryption:
  162. # Allow encryption, work in group chat rooms with e2ee enabled
  163. allow: false
  164. # Default to encryption, force-enable encryption in all portals the bridge creates
  165. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  166. default: false
  167. # Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data.
  168. appservice: false
  169. # Require encryption, drop any unencrypted messages.
  170. require: false
  171. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  172. # You must use a client that supports requesting keys from other users to use this feature.
  173. allow_key_sharing: false
  174. # What level of device verification should be required from users?
  175. #
  176. # Valid levels:
  177. # unverified - Send keys to all device in the room.
  178. # cross-signed-untrusted - Require valid cross-signing, but trust all cross-signing keys.
  179. # cross-signed-tofu - Require valid cross-signing, trust cross-signing keys on first use (and reject changes).
  180. # cross-signed-verified - Require valid cross-signing, plus a valid user signature from the bridge bot.
  181. # Note that creating user signatures from the bridge bot is not currently possible.
  182. # verified - Require manual per-device verification
  183. # (currently only possible by modifying the `trust` column in the `crypto_device` database table).
  184. verification_levels:
  185. # Minimum level for which the bridge should send keys to when bridging messages from Telegram to Matrix.
  186. receive: unverified
  187. # Minimum level that the bridge should accept for incoming Matrix messages.
  188. send: unverified
  189. # Minimum level that the bridge should require for accepting key requests.
  190. share: cross-signed-tofu
  191. # Options for Megolm room key rotation. These options allow you to
  192. # configure the m.room.encryption event content. See:
  193. # https://spec.matrix.org/v1.3/client-server-api/#mroomencryption for
  194. # more information about that event.
  195. rotation:
  196. # Enable custom Megolm room key rotation settings. Note that these
  197. # settings will only apply to rooms created after this option is
  198. # set.
  199. enable_custom: false
  200. # The maximum number of milliseconds a session should be used
  201. # before changing it. The Matrix spec recommends 604800000 (a week)
  202. # as the default.
  203. milliseconds: 604800000
  204. # The maximum number of messages that should be sent with a given a
  205. # session before changing it. The Matrix spec recommends 100 as the
  206. # default.
  207. messages: 100
  208. # Whether or not to explicitly set the avatar and room name for private
  209. # chat portal rooms. This will be implicitly enabled if encryption.default is true.
  210. private_chat_portal_meta: false
  211. # Whether or not the bridge should send a read receipt from the bridge bot when a message has
  212. # been sent to Instagram.
  213. delivery_receipts: false
  214. # Whether or not delivery errors should be reported as messages in the Matrix room.
  215. delivery_error_reports: false
  216. # Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
  217. message_status_events: false
  218. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  219. # This field will automatically be changed back to false after it,
  220. # except if the config file is not writable.
  221. resend_bridge_info: false
  222. # Whether or not unimportant bridge notices should be sent to the user.
  223. # (e.g. connected, disconnected but will retry)
  224. unimportant_bridge_notices: true
  225. # Disable bridge notices entirely
  226. disable_bridge_notices: false
  227. # Send captions in the same message as images. This will send data compatible with both MSC2530 and MSC3552.
  228. # This is currently not supported in most clients.
  229. caption_in_message: false
  230. # Should Matrix m.notice-type messages be bridged?
  231. bridge_notices: true
  232. # Provisioning API part of the web server for automated portal creation and fetching information.
  233. # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
  234. provisioning:
  235. # Whether or not the provisioning API should be enabled.
  236. enabled: true
  237. # The prefix to use in the provisioning API endpoints.
  238. prefix: /_matrix/provision/v1
  239. # The shared secret to authorize users of the API.
  240. # Set to "generate" to generate and save a new token.
  241. shared_secret: generate
  242. # Segment API key to enable analytics tracking for web server endpoints. Set to null to disable.
  243. segment_key: null
  244. # The prefix for commands. Only required in non-management rooms.
  245. command_prefix: "!ig"
  246. # Permissions for using the bridge.
  247. # Permitted values:
  248. # relay - Allowed to be relayed through the bridge, no access to commands.
  249. # user - Use the bridge with puppeting.
  250. # admin - Use and administrate the bridge.
  251. # Permitted keys:
  252. # * - All Matrix users
  253. # domain - All users on that homeserver
  254. # mxid - Specific user
  255. permissions:
  256. "*": "relay"
  257. "example.com": "user"
  258. "@admin:example.com": "admin"
  259. relay:
  260. # Whether relay mode should be allowed. If allowed, `!ig set-relay` can be used to turn any
  261. # authenticated user into a relaybot for that chat.
  262. enabled: false
  263. # The formats to use when sending messages to Instagram via a relay user.
  264. #
  265. # Available variables:
  266. # $sender_displayname - The display name of the sender (e.g. Example User)
  267. # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
  268. # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
  269. # $message - The message content
  270. #
  271. # Note that Instagram doesn't support captions for images, so images won't include any indication of being relayed.
  272. message_formats:
  273. m.text: '$sender_displayname: $message'
  274. m.notice: '$sender_displayname: $message'
  275. m.emote: '* $sender_displayname $message'
  276. # Python logging configuration.
  277. #
  278. # See section 16.7.2 of the Python documentation for more info:
  279. # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
  280. logging:
  281. version: 1
  282. formatters:
  283. colored:
  284. (): mautrix_instagram.util.ColorFormatter
  285. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  286. normal:
  287. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  288. handlers:
  289. file:
  290. class: logging.handlers.RotatingFileHandler
  291. formatter: normal
  292. filename: ./mautrix-instagram.log
  293. maxBytes: 10485760
  294. backupCount: 10
  295. console:
  296. class: logging.StreamHandler
  297. formatter: colored
  298. loggers:
  299. mau:
  300. level: DEBUG
  301. mauigpapi:
  302. level: DEBUG
  303. aiohttp:
  304. level: INFO
  305. paho.mqtt:
  306. level: INFO
  307. root:
  308. level: DEBUG
  309. handlers: [file, console]