example-config.yaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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. asmux: false
  11. # Number of retries for all HTTP requests if the homeserver isn't reachable.
  12. http_retry_count: 4
  13. # The URL to push real-time bridge status to.
  14. # If set, the bridge will make POST requests to this URL whenever a user's Instagram MQTT connection state changes.
  15. # The bridge will use the appservice as_token to authorize requests.
  16. status_endpoint: null
  17. # Endpoint for reporting per-message status.
  18. message_send_checkpoint_endpoint: null
  19. # Whether asynchronous uploads via MSC2246 should be enabled for media.
  20. # Requires a media repo that supports MSC2246.
  21. async_media: false
  22. # Application service host/registration related details
  23. # Changing these values requires regeneration of the registration.
  24. appservice:
  25. # The address that the homeserver can use to connect to this appservice.
  26. address: http://localhost:29330
  27. # When using https:// the TLS certificate and key files for the address.
  28. tls_cert: false
  29. tls_key: false
  30. # The hostname and port where this appservice should listen.
  31. hostname: 0.0.0.0
  32. port: 29330
  33. # The maximum body size of appservice API requests (from the homeserver) in mebibytes
  34. # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
  35. max_body_size: 1
  36. # The full URI to the database. Only Postgres is currently supported.
  37. database: postgres://username:password@hostname/db
  38. # Additional arguments for asyncpg.create_pool()
  39. # https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool
  40. database_opts:
  41. min_size: 5
  42. max_size: 10
  43. # The unique ID of this appservice.
  44. id: instagram
  45. # Username of the appservice bot.
  46. bot_username: instagrambot
  47. # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
  48. # to leave display name/avatar as-is.
  49. bot_displayname: Instagram bridge bot
  50. bot_avatar: mxc://maunium.net/JxjlbZUlCPULEeHZSwleUXQv
  51. # Whether or not to receive ephemeral events via appservice transactions.
  52. # Requires MSC2409 support (i.e. Synapse 1.22+).
  53. # You should disable bridge -> sync_with_custom_puppets when this is enabled.
  54. ephemeral_events: false
  55. # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
  56. as_token: "This value is generated when generating the registration"
  57. hs_token: "This value is generated when generating the registration"
  58. # Prometheus telemetry config. Requires prometheus-client to be installed.
  59. metrics:
  60. enabled: false
  61. listen_port: 8000
  62. # Manhole config.
  63. manhole:
  64. # Whether or not opening the manhole is allowed.
  65. enabled: false
  66. # The path for the unix socket.
  67. path: /var/tmp/mautrix-instagram.manhole
  68. # The list of UIDs who can be added to the whitelist.
  69. # If empty, any UIDs can be specified in the open-manhole command.
  70. whitelist:
  71. - 0
  72. instagram:
  73. # Seed for generating devices. This is secret because the seed is used to generate
  74. # device IDs, which can apparently be used to bypass two-factor authentication after
  75. # logging out, because Instagram is insecure.
  76. device_seed: generate
  77. # Bridge config
  78. bridge:
  79. # Localpart template of MXIDs for Instagram users.
  80. # {userid} is replaced with the user ID of the Instagram user.
  81. username_template: "instagram_{userid}"
  82. # Displayname template for Instagram users.
  83. # {displayname} is replaced with the display name of the Instagram user.
  84. # {username} is replaced with the username of the Instagram user.
  85. displayname_template: "{displayname} (Instagram)"
  86. # Displayname template for 1:1 chat portals. Same variables as displayname_template.
  87. private_chat_name_template: "{displayname}"
  88. # Displayname template for group chat portals. Only {name} is available.
  89. group_chat_name_template: "{name}"
  90. # Maximum length of displayname
  91. displayname_max_length: 100
  92. # Maximum number of seconds since the last activity in a chat to automatically create portals.
  93. portal_create_max_age: 259200
  94. # Maximum number of chats to fetch for startup sync
  95. chat_sync_limit: 20
  96. # Maximum number of chats to create during startup sync
  97. chat_create_limit: 10
  98. # Should the chat list be synced on startup?
  99. # If false, the bridge will try to reconnect to MQTT directly and ask the server to send missed events.
  100. resync_on_startup: true
  101. # Whether or not to use /sync to get read receipts and typing notifications
  102. # when double puppeting is enabled
  103. sync_with_custom_puppets: true
  104. # Whether or not to update the m.direct account data event when double puppeting is enabled.
  105. # Note that updating the m.direct event is not atomic (except with mautrix-asmux)
  106. # and is therefore prone to race conditions.
  107. sync_direct_chat_list: false
  108. # Allow using double puppeting from any server with a valid client .well-known file.
  109. double_puppet_allow_discovery: false
  110. # Servers to allow double puppeting from, even if double_puppet_allow_discovery is false.
  111. double_puppet_server_map:
  112. example.com: https://example.com
  113. # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
  114. #
  115. # If set, custom puppets will be enabled automatically for local users
  116. # instead of users having to find an access token and run `login-matrix`
  117. # manually.
  118. # If using this for other servers than the bridge's server,
  119. # you must also set the URL in the double_puppet_server_map.
  120. login_shared_secret_map:
  121. example.com: foo
  122. # Whether or not created rooms should have federation enabled.
  123. # If false, created portal rooms will never be federated.
  124. federate_rooms: true
  125. # Settings for backfilling messages from Instagram.
  126. backfill:
  127. # Whether or not the Instagram users of logged in Matrix users should be
  128. # invited to private chats when backfilling history from Instagram. This is
  129. # usually needed to prevent rate limits and to allow timestamp massaging.
  130. invite_own_puppet: true
  131. # Maximum number of messages to backfill initially.
  132. # Set to 0 to disable backfilling when creating portal.
  133. initial_limit: 0
  134. # Maximum number of messages to backfill if messages were missed while
  135. # the bridge was disconnected.
  136. # Set to 0 to disable backfilling missed messages.
  137. missed_limit: 1000
  138. # If using double puppeting, should notifications be disabled
  139. # while the initial backfill is in progress?
  140. disable_notifications: false
  141. periodic_reconnect:
  142. # Interval in seconds in which to automatically reconnect all users.
  143. # This can be used to automatically mitigate the bug where Instagram stops sending messages.
  144. # Set to -1 to disable periodic reconnections entirely.
  145. interval: -1
  146. # Whether or not the bridge should backfill chats when reconnecting.
  147. resync: true
  148. # Should even disconnected users be reconnected?
  149. always: false
  150. # End-to-bridge encryption support options.
  151. #
  152. # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
  153. encryption:
  154. # Allow encryption, work in group chat rooms with e2ee enabled
  155. allow: false
  156. # Default to encryption, force-enable encryption in all portals the bridge creates
  157. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  158. default: false
  159. # Require encryption, drop any unencrypted messages.
  160. require: false
  161. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  162. # You must use a client that supports requesting keys from other users to use this feature.
  163. allow_key_sharing: false
  164. # What level of device verification should be required from users?
  165. #
  166. # Valid levels:
  167. # unverified - Send keys to all device in the room.
  168. # cross-signed-untrusted - Require valid cross-signing, but trust all cross-signing keys.
  169. # cross-signed-tofu - Require valid cross-signing, trust cross-signing keys on first use (and reject changes).
  170. # cross-signed-verified - Require valid cross-signing, plus a valid user signature from the bridge bot.
  171. # Note that creating user signatures from the bridge bot is not currently possible.
  172. # verified - Require manual per-device verification
  173. # (currently only possible by modifying the `trust` column in the `crypto_device` database table).
  174. verification_levels:
  175. # Minimum level for which the bridge should send keys to when bridging messages from Telegram to Matrix.
  176. receive: unverified
  177. # Minimum level that the bridge should accept for incoming Matrix messages.
  178. send: unverified
  179. # Minimum level that the bridge should require for accepting key requests.
  180. share: cross-signed-tofu
  181. # Options for Megolm room key rotation. These options allow you to
  182. # configure the m.room.encryption event content. See:
  183. # https://spec.matrix.org/v1.3/client-server-api/#mroomencryption for
  184. # more information about that event.
  185. rotation:
  186. # Enable custom Megolm room key rotation settings. Note that these
  187. # settings will only apply to rooms created after this option is
  188. # set.
  189. enable_custom: false
  190. # The maximum number of milliseconds a session should be used
  191. # before changing it. The Matrix spec recommends 604800000 (a week)
  192. # as the default.
  193. milliseconds: 604800000
  194. # The maximum number of messages that should be sent with a given a
  195. # session before changing it. The Matrix spec recommends 100 as the
  196. # default.
  197. messages: 100
  198. # Whether or not to explicitly set the avatar and room name for private
  199. # chat portal rooms. This will be implicitly enabled if encryption.default is true.
  200. private_chat_portal_meta: false
  201. # Whether or not the bridge should send a read receipt from the bridge bot when a message has
  202. # been sent to Instagram.
  203. delivery_receipts: false
  204. # Whether or not delivery errors should be reported as messages in the Matrix room.
  205. delivery_error_reports: false
  206. # Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
  207. message_status_events: false
  208. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  209. # This field will automatically be changed back to false after it,
  210. # except if the config file is not writable.
  211. resend_bridge_info: false
  212. # Whether or not unimportant bridge notices should be sent to the user.
  213. # (e.g. connected, disconnected but will retry)
  214. unimportant_bridge_notices: true
  215. # Disable bridge notices entirely
  216. disable_bridge_notices: false
  217. # Provisioning API part of the web server for automated portal creation and fetching information.
  218. # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
  219. provisioning:
  220. # Whether or not the provisioning API should be enabled.
  221. enabled: true
  222. # The prefix to use in the provisioning API endpoints.
  223. prefix: /_matrix/provision/v1
  224. # The shared secret to authorize users of the API.
  225. # Set to "generate" to generate and save a new token.
  226. shared_secret: generate
  227. # Segment API key to enable analytics tracking for web server endpoints. Set to null to disable.
  228. segment_key: null
  229. # The prefix for commands. Only required in non-management rooms.
  230. command_prefix: "!ig"
  231. # Permissions for using the bridge.
  232. # Permitted values:
  233. # relay - Allowed to be relayed through the bridge, no access to commands.
  234. # user - Use the bridge with puppeting.
  235. # admin - Use and administrate the bridge.
  236. # Permitted keys:
  237. # * - All Matrix users
  238. # domain - All users on that homeserver
  239. # mxid - Specific user
  240. permissions:
  241. "*": "relay"
  242. "example.com": "user"
  243. "@admin:example.com": "admin"
  244. relay:
  245. # Whether relay mode should be allowed. If allowed, `!ig set-relay` can be used to turn any
  246. # authenticated user into a relaybot for that chat.
  247. enabled: false
  248. # The formats to use when sending messages to Instagram via a relay user.
  249. #
  250. # Available variables:
  251. # $sender_displayname - The display name of the sender (e.g. Example User)
  252. # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
  253. # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
  254. # $message - The message content
  255. #
  256. # Note that Instagram doesn't support captions for images, so images won't include any indication of being relayed.
  257. message_formats:
  258. m.text: '$sender_displayname: $message'
  259. m.notice: '$sender_displayname: $message'
  260. m.emote: '* $sender_displayname $message'
  261. # Python logging configuration.
  262. #
  263. # See section 16.7.2 of the Python documentation for more info:
  264. # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
  265. logging:
  266. version: 1
  267. formatters:
  268. colored:
  269. (): mautrix_instagram.util.ColorFormatter
  270. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  271. normal:
  272. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  273. handlers:
  274. file:
  275. class: logging.handlers.RotatingFileHandler
  276. formatter: normal
  277. filename: ./mautrix-instagram.log
  278. maxBytes: 10485760
  279. backupCount: 10
  280. console:
  281. class: logging.StreamHandler
  282. formatter: colored
  283. loggers:
  284. mau:
  285. level: DEBUG
  286. mauigpapi:
  287. level: DEBUG
  288. aiohttp:
  289. level: INFO
  290. paho.mqtt:
  291. level: INFO
  292. root:
  293. level: DEBUG
  294. handlers: [file, console]