example-config.yaml 22 KB

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