example-config.yaml 12 KB

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