example-config.yaml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. # Homeserver details.
  2. homeserver:
  3. # The address that this appservice can use to connect to the homeserver.
  4. address: https://matrix.example.com
  5. # The domain of the homeserver (also known as server_name, used for MXIDs, etc).
  6. domain: example.com
  7. # What software is the homeserver running?
  8. # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here.
  9. software: standard
  10. # The URL to push real-time bridge status to.
  11. # If set, the bridge will make POST requests to this URL whenever a user's whatsapp connection state changes.
  12. # The bridge will use the appservice as_token to authorize requests.
  13. status_endpoint: null
  14. # Endpoint for reporting per-message status.
  15. message_send_checkpoint_endpoint: null
  16. # Does the homeserver support https://github.com/matrix-org/matrix-spec-proposals/pull/2246?
  17. async_media: false
  18. # Should the bridge use a websocket for connecting to the homeserver?
  19. # The server side is currently not documented anywhere and is only implemented by mautrix-wsproxy,
  20. # mautrix-asmux (deprecated), and hungryserv (proprietary).
  21. websocket: false
  22. # How often should the websocket be pinged? Pinging will be disabled if this is zero.
  23. ping_interval_seconds: 0
  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:29318
  29. # The hostname and port where this appservice should listen.
  30. hostname: 0.0.0.0
  31. port: 29318
  32. # Database config.
  33. database:
  34. # The database type. "sqlite3-fk-wal" and "postgres" are supported.
  35. type: postgres
  36. # The database URI.
  37. # SQLite: A raw file path is supported, but `file:<path>?_txlock=immediate` is recommended.
  38. # https://github.com/mattn/go-sqlite3#connection-string
  39. # Postgres: Connection string. For example, postgres://user:password@host/database?sslmode=disable
  40. # To connect via Unix socket, use something like postgres:///dbname?host=/var/run/postgresql
  41. uri: postgres://user:password@host/database?sslmode=disable
  42. # Maximum number of connections. Mostly relevant for Postgres.
  43. max_open_conns: 20
  44. max_idle_conns: 2
  45. # Maximum connection idle time and lifetime before they're closed. Disabled if null.
  46. # Parsed with https://pkg.go.dev/time#ParseDuration
  47. max_conn_idle_time: null
  48. max_conn_lifetime: null
  49. # The unique ID of this appservice.
  50. id: whatsapp
  51. # Appservice bot details.
  52. bot:
  53. # Username of the appservice bot.
  54. username: whatsappbot
  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. displayname: WhatsApp bridge bot
  58. avatar: mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr
  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. # Should incoming events be handled asynchronously?
  64. # This may be necessary for large public instances with lots of messages going through.
  65. # However, messages will not be guaranteed to be bridged in the same order they were sent in.
  66. async_transactions: false
  67. # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
  68. as_token: "This value is generated when generating the registration"
  69. hs_token: "This value is generated when generating the registration"
  70. # Segment API key to track some events, like provisioning API login and encryption errors.
  71. segment_key: null
  72. # Optional user_id to use when sending Segment events. If null, defaults to using mxID.
  73. segment_user_id: null
  74. # Prometheus config.
  75. metrics:
  76. # Enable prometheus metrics?
  77. enabled: false
  78. # IP and port where the metrics listener should be. The path is always /metrics
  79. listen: 127.0.0.1:8001
  80. # Config for things that are directly sent to WhatsApp.
  81. whatsapp:
  82. # Device name that's shown in the "WhatsApp Web" section in the mobile app.
  83. os_name: Mautrix-WhatsApp bridge
  84. # Browser name that determines the logo shown in the mobile app.
  85. # Must be "unknown" for a generic icon or a valid browser name if you want a specific icon.
  86. # List of valid browser names: https://github.com/tulir/whatsmeow/blob/efc632c008604016ddde63bfcfca8de4e5304da9/binary/proto/def.proto#L43-L64
  87. browser_name: unknown
  88. # Bridge config
  89. bridge:
  90. # Localpart template of MXIDs for WhatsApp users.
  91. # {{.}} is replaced with the phone number of the WhatsApp user.
  92. username_template: whatsapp_{{.}}
  93. # Displayname template for WhatsApp users.
  94. # {{.PushName}} - nickname set by the WhatsApp user
  95. # {{.BusinessName}} - validated WhatsApp business name
  96. # {{.Phone}} - phone number (international format)
  97. # The following variables are also available, but will cause problems on multi-user instances:
  98. # {{.FullName}} - full name from contact list
  99. # {{.FirstName}} - first name from contact list
  100. displayname_template: "{{or .BusinessName .PushName .JID}} (WA)"
  101. # Should the bridge create a space for each logged-in user and add bridged rooms to it?
  102. # Users who logged in before turning this on should run `!wa sync space` to create and fill the space for the first time.
  103. personal_filtering_spaces: false
  104. # Should the bridge send a read receipt from the bridge bot when a message has been sent to WhatsApp?
  105. delivery_receipts: false
  106. # Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
  107. message_status_events: false
  108. # Whether the bridge should send error notices via m.notice events when a message fails to bridge.
  109. message_error_notices: true
  110. # Should incoming calls send a message to the Matrix room?
  111. call_start_notices: true
  112. # Should another user's cryptographic identity changing send a message to Matrix?
  113. identity_change_notices: false
  114. portal_message_buffer: 128
  115. # Settings for handling history sync payloads.
  116. history_sync:
  117. # Enable backfilling history sync payloads from WhatsApp?
  118. backfill: true
  119. # The maximum number of initial conversations that should be synced.
  120. # Other conversations will be backfilled on demand when receiving a message or when initiating a direct chat.
  121. max_initial_conversations: -1
  122. # Maximum number of messages to backfill in each conversation.
  123. # Set to -1 to disable limit.
  124. message_count: 50
  125. # Should the bridge request a full sync from the phone when logging in?
  126. # This bumps the size of history syncs from 3 months to 1 year.
  127. request_full_sync: false
  128. # Configuration parameters that are sent to the phone along with the request full sync flag.
  129. # By default (when the values are null or 0), the config isn't sent at all.
  130. full_sync_config:
  131. # Number of days of history to request.
  132. # The limit seems to be around 3 years, but using higher values doesn't break.
  133. days_limit: null
  134. # This is presumably the maximum size of the transferred history sync blob, which may affect what the phone includes in the blob.
  135. size_mb_limit: null
  136. # This is presumably the local storage quota, which may affect what the phone includes in the history sync blob.
  137. storage_quota_mb: null
  138. # If this value is greater than 0, then if the conversation's last message was more than
  139. # this number of hours ago, then the conversation will automatically be marked it as read.
  140. # Conversations that have a last message that is less than this number of hours ago will
  141. # have their unread status synced from WhatsApp.
  142. unread_hours_threshold: 0
  143. ###############################################################################
  144. # The settings below are only applicable for backfilling using batch sending, #
  145. # which is no longer supported in Synapse. #
  146. ###############################################################################
  147. # Settings for media requests. If the media expired, then it will not be on the WA servers.
  148. # Media can always be requested by reacting with the ♻️ (recycle) emoji.
  149. # These settings determine if the media requests should be done automatically during or after backfill.
  150. media_requests:
  151. # Should expired media be automatically requested from the server as part of the backfill process?
  152. auto_request_media: true
  153. # Whether to request the media immediately after the media message is backfilled ("immediate")
  154. # or at a specific time of the day ("local_time").
  155. request_method: immediate
  156. # If request_method is "local_time", what time should the requests be sent (in minutes after midnight)?
  157. request_local_time: 120
  158. # Settings for immediate backfills. These backfills should generally be small and their main purpose is
  159. # to populate each of the initial chats (as configured by max_initial_conversations) with a few messages
  160. # so that you can continue conversations without losing context.
  161. immediate:
  162. # The number of concurrent backfill workers to create for immediate backfills.
  163. # Note that using more than one worker could cause the room list to jump around
  164. # since there are no guarantees about the order in which the backfills will complete.
  165. worker_count: 1
  166. # The maximum number of events to backfill initially.
  167. max_events: 10
  168. # Settings for deferred backfills. The purpose of these backfills are to fill in the rest of
  169. # the chat history that was not covered by the immediate backfills.
  170. # These backfills generally should happen at a slower pace so as not to overload the homeserver.
  171. # Each deferred backfill config should define a "stage" of backfill (i.e. the last week of messages).
  172. # The fields are as follows:
  173. # - start_days_ago: the number of days ago to start backfilling from.
  174. # To indicate the start of time, use -1. For example, for a week ago, use 7.
  175. # - max_batch_events: the number of events to send per batch.
  176. # - batch_delay: the number of seconds to wait before backfilling each batch.
  177. deferred:
  178. # Last Week
  179. - start_days_ago: 7
  180. max_batch_events: 20
  181. batch_delay: 5
  182. # Last Month
  183. - start_days_ago: 30
  184. max_batch_events: 50
  185. batch_delay: 10
  186. # Last 3 months
  187. - start_days_ago: 90
  188. max_batch_events: 100
  189. batch_delay: 10
  190. # The start of time
  191. - start_days_ago: -1
  192. max_batch_events: 500
  193. batch_delay: 10
  194. # Should puppet avatars be fetched from the server even if an avatar is already set?
  195. user_avatar_sync: true
  196. # Should Matrix users leaving groups be bridged to WhatsApp?
  197. bridge_matrix_leave: true
  198. # Should the bridge sync with double puppeting to receive EDUs that aren't normally sent to appservices.
  199. sync_with_custom_puppets: false
  200. # Should the bridge update the m.direct account data event when double puppeting is enabled.
  201. # Note that updating the m.direct event is not atomic (except with mautrix-asmux)
  202. # and is therefore prone to race conditions.
  203. sync_direct_chat_list: false
  204. # Should the bridge use MSC2867 to bridge manual "mark as unread"s from
  205. # WhatsApp and set the unread status on initial backfill?
  206. # This will only work on clients that support the m.marked_unread or
  207. # com.famedly.marked_unread room account data.
  208. sync_manual_marked_unread: true
  209. # When double puppeting is enabled, users can use `!wa toggle` to change whether
  210. # presence and read receipts are bridged. These settings set the default values.
  211. # Existing users won't be affected when these are changed.
  212. default_bridge_receipts: true
  213. default_bridge_presence: true
  214. # Send the presence as "available" to whatsapp when users start typing on a portal.
  215. # This works as a workaround for homeservers that do not support presence, and allows
  216. # users to see when the whatsapp user on the other side is typing during a conversation.
  217. send_presence_on_typing: false
  218. # Should the bridge always send "active" delivery receipts (two gray ticks on WhatsApp)
  219. # even if the user isn't marked as online (e.g. when presence bridging isn't enabled)?
  220. #
  221. # By default, the bridge acts like WhatsApp web, which only sends active delivery
  222. # receipts when it's in the foreground.
  223. force_active_delivery_receipts: false
  224. # Servers to always allow double puppeting from
  225. double_puppet_server_map:
  226. example.com: https://example.com
  227. # Allow using double puppeting from any server with a valid client .well-known file.
  228. double_puppet_allow_discovery: false
  229. # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
  230. #
  231. # If set, double puppeting will be enabled automatically for local users
  232. # instead of users having to find an access token and run `login-matrix`
  233. # manually.
  234. login_shared_secret_map:
  235. example.com: foobar
  236. # Whether to explicitly set the avatar and room name for private chat portal rooms.
  237. # If set to `default`, this will be enabled in encrypted rooms and disabled in unencrypted rooms.
  238. # If set to `always`, all DM rooms will have explicit names and avatars set.
  239. # If set to `never`, DM rooms will never have names and avatars set.
  240. private_chat_portal_meta: default
  241. # Should group members be synced in parallel? This makes member sync faster
  242. parallel_member_sync: false
  243. # Should Matrix m.notice-type messages be bridged?
  244. bridge_notices: true
  245. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  246. # This field will automatically be changed back to false after it, except if the config file is not writable.
  247. resend_bridge_info: false
  248. # When using double puppeting, should muted chats be muted in Matrix?
  249. mute_bridging: false
  250. # When using double puppeting, should archived chats be moved to a specific tag in Matrix?
  251. # Note that WhatsApp unarchives chats when a message is received, which will also be mirrored to Matrix.
  252. # This can be set to a tag (e.g. m.lowpriority), or null to disable.
  253. archive_tag: null
  254. # Same as above, but for pinned chats. The favorite tag is called m.favourite
  255. pinned_tag: null
  256. # Should mute status and tags only be bridged when the portal room is created?
  257. tag_only_on_create: true
  258. # Should WhatsApp status messages be bridged into a Matrix room?
  259. # Disabling this won't affect already created status broadcast rooms.
  260. enable_status_broadcast: true
  261. # Should sending WhatsApp status messages be allowed?
  262. # This can cause issues if the user has lots of contacts, so it's disabled by default.
  263. disable_status_broadcast_send: true
  264. # Should the status broadcast room be muted and moved into low priority by default?
  265. # This is only applied when creating the room, the user can unmute it later.
  266. mute_status_broadcast: true
  267. # Tag to apply to the status broadcast room.
  268. status_broadcast_tag: m.lowpriority
  269. # Should the bridge use thumbnails from WhatsApp?
  270. # They're disabled by default due to very low resolution.
  271. whatsapp_thumbnail: false
  272. # Allow invite permission for user. User can invite any bots to room with whatsapp
  273. # users (private chat and groups)
  274. allow_user_invite: false
  275. # Whether or not created rooms should have federation enabled.
  276. # If false, created portal rooms will never be federated.
  277. federate_rooms: true
  278. # Should the bridge never send alerts to the bridge management room?
  279. # These are mostly things like the user being logged out.
  280. disable_bridge_alerts: false
  281. # Should the bridge stop if the WhatsApp server says another user connected with the same session?
  282. # This is only safe on single-user bridges.
  283. crash_on_stream_replaced: false
  284. # Should the bridge detect URLs in outgoing messages, ask the homeserver to generate a preview,
  285. # and send it to WhatsApp? URL previews can always be sent using the `com.beeper.linkpreviews`
  286. # key in the event content even if this is disabled.
  287. url_previews: false
  288. # Send captions in the same message as images. This will send data compatible with both MSC2530 and MSC3552.
  289. # This is currently not supported in most clients.
  290. caption_in_message: false
  291. # Should polls be sent using MSC3381 event types?
  292. extev_polls: false
  293. # Should cross-chat replies from WhatsApp be bridged? Most servers and clients don't support this.
  294. cross_room_replies: false
  295. # Disable generating reply fallbacks? Some extremely bad clients still rely on them,
  296. # but they're being phased out and will be completely removed in the future.
  297. disable_reply_fallbacks: false
  298. # Maximum time for handling Matrix events. Duration strings formatted for https://pkg.go.dev/time#ParseDuration
  299. # Null means there's no enforced timeout.
  300. message_handling_timeout:
  301. # Send an error message after this timeout, but keep waiting for the response until the deadline.
  302. # This is counted from the origin_server_ts, so the warning time is consistent regardless of the source of delay.
  303. # If the message is older than this when it reaches the bridge, the message won't be handled at all.
  304. error_after: null
  305. # Drop messages after this timeout. They may still go through if the message got sent to the servers.
  306. # This is counted from the time the bridge starts handling the message.
  307. deadline: 120s
  308. # The prefix for commands. Only required in non-management rooms.
  309. command_prefix: "!wa"
  310. # Messages sent upon joining a management room.
  311. # Markdown is supported. The defaults are listed below.
  312. management_room_text:
  313. # Sent when joining a room.
  314. welcome: "Hello, I'm a WhatsApp bridge bot."
  315. # Sent when joining a management room and the user is already logged in.
  316. welcome_connected: "Use `help` for help."
  317. # Sent when joining a management room and the user is not logged in.
  318. welcome_unconnected: "Use `help` for help or `login` to log in."
  319. # Optional extra text sent when joining a management room.
  320. additional_help: ""
  321. # End-to-bridge encryption support options.
  322. #
  323. # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
  324. encryption:
  325. # Allow encryption, work in group chat rooms with e2ee enabled
  326. allow: false
  327. # Default to encryption, force-enable encryption in all portals the bridge creates
  328. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  329. default: false
  330. # Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data.
  331. appservice: false
  332. # Require encryption, drop any unencrypted messages.
  333. require: false
  334. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  335. # You must use a client that supports requesting keys from other users to use this feature.
  336. allow_key_sharing: false
  337. # Should users mentions be in the event wire content to enable the server to send push notifications?
  338. plaintext_mentions: false
  339. # Options for deleting megolm sessions from the bridge.
  340. delete_keys:
  341. # Beeper-specific: delete outbound sessions when hungryserv confirms
  342. # that the user has uploaded the key to key backup.
  343. delete_outbound_on_ack: false
  344. # Don't store outbound sessions in the inbound table.
  345. dont_store_outbound: false
  346. # Ratchet megolm sessions forward after decrypting messages.
  347. ratchet_on_decrypt: false
  348. # Delete fully used keys (index >= max_messages) after decrypting messages.
  349. delete_fully_used_on_decrypt: false
  350. # Delete previous megolm sessions from same device when receiving a new one.
  351. delete_prev_on_new_session: false
  352. # Delete megolm sessions received from a device when the device is deleted.
  353. delete_on_device_delete: false
  354. # Periodically delete megolm sessions when 2x max_age has passed since receiving the session.
  355. periodically_delete_expired: false
  356. # Delete inbound megolm sessions that don't have the received_at field used for
  357. # automatic ratcheting and expired session deletion. This is meant as a migration
  358. # to delete old keys prior to the bridge update.
  359. delete_outdated_inbound: false
  360. # What level of device verification should be required from users?
  361. #
  362. # Valid levels:
  363. # unverified - Send keys to all device in the room.
  364. # cross-signed-untrusted - Require valid cross-signing, but trust all cross-signing keys.
  365. # cross-signed-tofu - Require valid cross-signing, trust cross-signing keys on first use (and reject changes).
  366. # cross-signed-verified - Require valid cross-signing, plus a valid user signature from the bridge bot.
  367. # Note that creating user signatures from the bridge bot is not currently possible.
  368. # verified - Require manual per-device verification
  369. # (currently only possible by modifying the `trust` column in the `crypto_device` database table).
  370. verification_levels:
  371. # Minimum level for which the bridge should send keys to when bridging messages from WhatsApp to Matrix.
  372. receive: unverified
  373. # Minimum level that the bridge should accept for incoming Matrix messages.
  374. send: unverified
  375. # Minimum level that the bridge should require for accepting key requests.
  376. share: cross-signed-tofu
  377. # Options for Megolm room key rotation. These options allow you to
  378. # configure the m.room.encryption event content. See:
  379. # https://spec.matrix.org/v1.3/client-server-api/#mroomencryption for
  380. # more information about that event.
  381. rotation:
  382. # Enable custom Megolm room key rotation settings. Note that these
  383. # settings will only apply to rooms created after this option is
  384. # set.
  385. enable_custom: false
  386. # The maximum number of milliseconds a session should be used
  387. # before changing it. The Matrix spec recommends 604800000 (a week)
  388. # as the default.
  389. milliseconds: 604800000
  390. # The maximum number of messages that should be sent with a given a
  391. # session before changing it. The Matrix spec recommends 100 as the
  392. # default.
  393. messages: 100
  394. # Disable rotating keys when a user's devices change?
  395. # You should not enable this option unless you understand all the implications.
  396. disable_device_change_key_rotation: false
  397. # Settings for provisioning API
  398. provisioning:
  399. # Prefix for the provisioning API paths.
  400. prefix: /_matrix/provision
  401. # Shared secret for authentication. If set to "generate", a random secret will be generated,
  402. # or if set to "disable", the provisioning API will be disabled.
  403. shared_secret: generate
  404. # Permissions for using the bridge.
  405. # Permitted values:
  406. # relay - Talk through the relaybot (if enabled), no access otherwise
  407. # user - Access to use the bridge to chat with a WhatsApp account.
  408. # admin - User level and some additional administration tools
  409. # Permitted keys:
  410. # * - All Matrix users
  411. # domain - All users on that homeserver
  412. # mxid - Specific user
  413. permissions:
  414. "*": relay
  415. "example.com": user
  416. "@admin:example.com": admin
  417. # Settings for relay mode
  418. relay:
  419. # Whether relay mode should be allowed. If allowed, `!wa set-relay` can be used to turn any
  420. # authenticated user into a relaybot for that chat.
  421. enabled: false
  422. # Should only admins be allowed to set themselves as relay users?
  423. admin_only: true
  424. # The formats to use when sending messages to WhatsApp via the relaybot.
  425. message_formats:
  426. m.text: "<b>{{ .Sender.Displayname }}</b>: {{ .Message }}"
  427. m.notice: "<b>{{ .Sender.Displayname }}</b>: {{ .Message }}"
  428. m.emote: "* <b>{{ .Sender.Displayname }}</b> {{ .Message }}"
  429. m.file: "<b>{{ .Sender.Displayname }}</b> sent a file"
  430. m.image: "<b>{{ .Sender.Displayname }}</b> sent an image"
  431. m.audio: "<b>{{ .Sender.Displayname }}</b> sent an audio file"
  432. m.video: "<b>{{ .Sender.Displayname }}</b> sent a video"
  433. m.location: "<b>{{ .Sender.Displayname }}</b> sent a location"
  434. # Logging config. See https://github.com/tulir/zeroconfig for details.
  435. logging:
  436. min_level: debug
  437. writers:
  438. - type: stdout
  439. format: pretty-colored
  440. - type: file
  441. format: json
  442. filename: ./logs/mautrix-whatsapp.log
  443. max_size: 100
  444. max_backups: 10
  445. compress: true