example-config.yaml 23 KB

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