example-config.yaml 24 KB

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