example-config.yaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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. You must install the e2be optional dependency for
  151. # this to work. See https://github.com/tulir/mautrix-telegram/wiki/End‐to‐bridge-encryption
  152. encryption:
  153. # Allow encryption, work in group chat rooms with e2ee enabled
  154. allow: false
  155. # Default to encryption, force-enable encryption in all portals the bridge creates
  156. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  157. default: false
  158. # Options for automatic key sharing.
  159. key_sharing:
  160. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  161. # You must use a client that supports requesting keys from other users to use this feature.
  162. allow: false
  163. # Require the requesting device to have a valid cross-signing signature?
  164. # This doesn't require that the bridge has verified the device, only that the user has verified it.
  165. # Not yet implemented.
  166. require_cross_signing: false
  167. # Require devices to be verified by the bridge?
  168. # Verification by the bridge is not yet implemented.
  169. require_verification: true
  170. # Whether or not to explicitly set the avatar and room name for private
  171. # chat portal rooms. This will be implicitly enabled if encryption.default is true.
  172. private_chat_portal_meta: false
  173. # Whether or not the bridge should send a read receipt from the bridge bot when a message has
  174. # been sent to Instagram.
  175. delivery_receipts: false
  176. # Whether or not delivery errors should be reported as messages in the Matrix room.
  177. delivery_error_reports: false
  178. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  179. # This field will automatically be changed back to false after it,
  180. # except if the config file is not writable.
  181. resend_bridge_info: false
  182. # Whether or not unimportant bridge notices should be sent to the user.
  183. # (e.g. connected, disconnected but will retry)
  184. unimportant_bridge_notices: true
  185. # Disable bridge notices entirely
  186. disable_bridge_notices: false
  187. # Provisioning API part of the web server for automated portal creation and fetching information.
  188. # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
  189. provisioning:
  190. # Whether or not the provisioning API should be enabled.
  191. enabled: true
  192. # The prefix to use in the provisioning API endpoints.
  193. prefix: /_matrix/provision/v1
  194. # The shared secret to authorize users of the API.
  195. # Set to "generate" to generate and save a new token.
  196. shared_secret: generate
  197. # Segment API key to enable analytics tracking for web server endpoints. Set to null to disable.
  198. segment_key: null
  199. # The prefix for commands. Only required in non-management rooms.
  200. command_prefix: "!ig"
  201. # Permissions for using the bridge.
  202. # Permitted values:
  203. # relay - Allowed to be relayed through the bridge, no access to commands.
  204. # user - Use the bridge with puppeting.
  205. # admin - Use and administrate the bridge.
  206. # Permitted keys:
  207. # * - All Matrix users
  208. # domain - All users on that homeserver
  209. # mxid - Specific user
  210. permissions:
  211. "*": "relay"
  212. "example.com": "user"
  213. "@admin:example.com": "admin"
  214. relay:
  215. # Whether relay mode should be allowed. If allowed, `!ig set-relay` can be used to turn any
  216. # authenticated user into a relaybot for that chat.
  217. enabled: false
  218. # The formats to use when sending messages to Instagram via a relay user.
  219. #
  220. # Available variables:
  221. # $sender_displayname - The display name of the sender (e.g. Example User)
  222. # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
  223. # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
  224. # $message - The message content
  225. #
  226. # Note that Instagram doesn't support captions for images, so images won't include any indication of being relayed.
  227. message_formats:
  228. m.text: '$sender_displayname: $message'
  229. m.notice: '$sender_displayname: $message'
  230. m.emote: '* $sender_displayname $message'
  231. # Python logging configuration.
  232. #
  233. # See section 16.7.2 of the Python documentation for more info:
  234. # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
  235. logging:
  236. version: 1
  237. formatters:
  238. colored:
  239. (): mautrix_instagram.util.ColorFormatter
  240. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  241. normal:
  242. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  243. handlers:
  244. file:
  245. class: logging.handlers.RotatingFileHandler
  246. formatter: normal
  247. filename: ./mautrix-instagram.log
  248. maxBytes: 10485760
  249. backupCount: 10
  250. console:
  251. class: logging.StreamHandler
  252. formatter: colored
  253. loggers:
  254. mau:
  255. level: DEBUG
  256. mauigpapi:
  257. level: DEBUG
  258. aiohttp:
  259. level: INFO
  260. paho.mqtt:
  261. level: INFO
  262. root:
  263. level: DEBUG
  264. handlers: [file, console]