example-config.yaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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: sqlite3
  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: mautrix-whatsapp.db
  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. # Settings for provisioning API
  42. provisioning:
  43. # Prefix for the provisioning API paths.
  44. prefix: /_matrix/provision
  45. # Shared secret for authentication. If set to "generate", a random secret will be generated,
  46. # or if set to "disable", the provisioning API will be disabled.
  47. shared_secret: generate
  48. # Segment API key to enable analytics tracking for web server
  49. # endpoints. Set to null to disable.
  50. # Currently the only events are login start, QR code retrieve, and login
  51. # success/failure.
  52. segment_key: null
  53. # The unique ID of this appservice.
  54. id: whatsapp
  55. # Appservice bot details.
  56. bot:
  57. # Username of the appservice bot.
  58. username: whatsappbot
  59. # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
  60. # to leave display name/avatar as-is.
  61. displayname: WhatsApp bridge bot
  62. avatar: mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr
  63. # Whether or not to receive ephemeral events via appservice transactions.
  64. # Requires MSC2409 support (i.e. Synapse 1.22+).
  65. # You should disable bridge -> sync_with_custom_puppets when this is enabled.
  66. ephemeral_events: 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. # Prometheus config.
  71. metrics:
  72. # Enable prometheus metrics?
  73. enabled: false
  74. # IP and port where the metrics listener should be. The path is always /metrics
  75. listen: 127.0.0.1:8001
  76. # Config for things that are directly sent to WhatsApp.
  77. whatsapp:
  78. # Device name that's shown in the "WhatsApp Web" section in the mobile app.
  79. os_name: Mautrix-WhatsApp bridge
  80. # Browser name that determines the logo shown in the mobile app.
  81. # Must be "unknown" for a generic icon or a valid browser name if you want a specific icon.
  82. # List of valid browser names: https://github.com/tulir/whatsmeow/blob/8b34d886d543b72e5f4699cf5b2797f68d598f78/binary/proto/def.proto#L38-L51
  83. browser_name: unknown
  84. # Decode outgoing binary XML payloads to try to make sure they're valid before sending to WhatsApp.
  85. debug_decode_before_send: false
  86. # Bridge config
  87. bridge:
  88. # Localpart template of MXIDs for WhatsApp users.
  89. # {{.}} is replaced with the phone number of the WhatsApp user.
  90. username_template: whatsapp_{{.}}
  91. # Displayname template for WhatsApp users.
  92. # {{.PushName}} - nickname set by the WhatsApp user
  93. # {{.BusinessName}} - validated WhatsApp business name
  94. # {{.Phone}} - phone number (international format)
  95. # The following variables are also available, but will cause problems on multi-user instances:
  96. # {{.FullName}} - full name from contact list
  97. # {{.FirstName}} - first name from contact list
  98. displayname_template: "{{if .PushName}}{{.PushName}}{{else if .BusinessName}}{{.BusinessName}}{{else}}{{.JID}}{{end}} (WA)"
  99. # Should the bridge create a space for each logged-in user and add bridged rooms to it?
  100. # Users who logged in before turning this on should run `!wa sync space` to create and fill the space for the first time.
  101. personal_filtering_spaces: false
  102. # Should the bridge send a read receipt from the bridge bot when a message has been sent to WhatsApp?
  103. delivery_receipts: false
  104. # Should incoming calls send a message to the Matrix room?
  105. call_start_notices: true
  106. # Should another user's cryptographic identity changing send a message to Matrix?
  107. identity_change_notices: false
  108. portal_message_buffer: 128
  109. # Settings for handling history sync payloads.
  110. history_sync:
  111. # Should the bridge create portals for chats in the history sync payload?
  112. create_portals: true
  113. # Enable backfilling history sync payloads from WhatsApp using batch sending?
  114. # This requires a server with MSC2716 support, which is currently an experimental feature in synapse.
  115. # It can be enabled by setting experimental_features -> msc2716_enabled to true in homeserver.yaml.
  116. # Note that prior to Synapse 1.49, there were some bugs with the implementation, especially if using event persistence workers.
  117. # There are also still some issues in Synapse's federation implementation.
  118. backfill: false
  119. # Use double puppets for backfilling?
  120. # In order to use this, the double puppets must be in the appservice's user ID namespace
  121. # (because the bridge can't use the double puppet access token with batch sending).
  122. # This only affects double puppets on the local server, double puppets on other servers will never be used.
  123. double_puppet_backfill: false
  124. # Should the bridge request a full sync from the phone when logging in?
  125. # This bumps the size of history syncs from 3 months to 1 year.
  126. request_full_sync: false
  127. # Should expired media be automatically requested from the server after backfilling?
  128. # If false, media can still be requested by reacting with the ♻️ (recycle) emoji.
  129. auto_request_media: true
  130. # The maximum number of initial conversations that should be synced.
  131. # Other conversations will be backfilled on demand when the start PM
  132. # provisioning endpoint is used or when a message comes in from that
  133. # chat.
  134. max_initial_conversations: -1
  135. # Settings for immediate backfills. These backfills should generally be
  136. # small and their main purpose is to populate each of the initial chats
  137. # (as configured by max_initial_conversations) with a few messages so
  138. # that you can continue conversations without loosing context.
  139. immediate:
  140. # The number of concurrent backfill workers to create for immediate
  141. # backfills. Note that using more than one worker could cause the
  142. # room list to jump around since there are no guarantees about the
  143. # order in which the backfills will complete.
  144. worker_count: 1
  145. # The maximum number of events to backfill initially.
  146. max_events: 10
  147. # Settings for deferred backfills. The purpose of these backfills are
  148. # to fill in the rest of the chat history that was not covered by the
  149. # immediate backfills. These backfills generally should happen at a
  150. # slower pace so as not to overload the homeserver.
  151. # Each deferred backfill config should define a "stage" of backfill
  152. # (i.e. the last week of messages). The fields are as follows:
  153. # - start_days_ago: the number of days ago to start backfilling from.
  154. # To indicate the start of time, use -1. For example, for a week ago, use 7.
  155. # - max_batch_events: the number of events to send per batch.
  156. # - batch_delay: the number of seconds to wait before backfilling each batch.
  157. deferred:
  158. # Last Week
  159. - start_days_ago: 7
  160. max_batch_events: 20
  161. batch_delay: 5
  162. # Last Month
  163. - start_days_ago: 30
  164. max_batch_events: 50
  165. batch_delay: 10
  166. # Last 3 months
  167. - start_days_ago: 90
  168. max_batch_events: 100
  169. batch_delay: 10
  170. # The start of time
  171. - start_days_ago: -1
  172. max_batch_events: 500
  173. batch_delay: 10
  174. # Should puppet avatars be fetched from the server even if an avatar is already set?
  175. user_avatar_sync: true
  176. # Should Matrix users leaving groups be bridged to WhatsApp?
  177. bridge_matrix_leave: true
  178. # Should the bridge sync with double puppeting to receive EDUs that aren't normally sent to appservices.
  179. sync_with_custom_puppets: true
  180. # Should the bridge update the m.direct account data event when double puppeting is enabled.
  181. # Note that updating the m.direct event is not atomic (except with mautrix-asmux)
  182. # and is therefore prone to race conditions.
  183. sync_direct_chat_list: false
  184. # When double puppeting is enabled, users can use `!wa toggle` to change whether
  185. # presence and read receipts are bridged. These settings set the default values.
  186. # Existing users won't be affected when these are changed.
  187. default_bridge_receipts: true
  188. default_bridge_presence: true
  189. # Send the presence as "available" to whatsapp when users start typing on a portal.
  190. # This works as a workaround for homeservers that do not support presence, and allows
  191. # users to see when the whatsapp user on the other side is typing during a conversation.
  192. send_presence_on_typing: false
  193. # Should the bridge always send "active" delivery receipts (two gray ticks on WhatsApp)
  194. # even if the user isn't marked as online (e.g. when presence bridging isn't enabled)?
  195. #
  196. # By default, the bridge acts like WhatsApp web, which only sends active delivery
  197. # receipts when it's in the foreground.
  198. force_active_delivery_receipts: false
  199. # Servers to always allow double puppeting from
  200. double_puppet_server_map:
  201. example.com: https://example.com
  202. # Allow using double puppeting from any server with a valid client .well-known file.
  203. double_puppet_allow_discovery: false
  204. # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
  205. #
  206. # If set, double puppeting will be enabled automatically for local users
  207. # instead of users having to find an access token and run `login-matrix`
  208. # manually.
  209. login_shared_secret_map:
  210. example.com: foobar
  211. # Should the bridge explicitly set the avatar and room name for private chat portal rooms?
  212. private_chat_portal_meta: false
  213. # Should Matrix m.notice-type messages be bridged?
  214. bridge_notices: true
  215. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  216. # This field will automatically be changed back to false after it, except if the config file is not writable.
  217. resend_bridge_info: false
  218. # When using double puppeting, should muted chats be muted in Matrix?
  219. mute_bridging: false
  220. # When using double puppeting, should archived chats be moved to a specific tag in Matrix?
  221. # Note that WhatsApp unarchives chats when a message is received, which will also be mirrored to Matrix.
  222. # This can be set to a tag (e.g. m.lowpriority), or null to disable.
  223. archive_tag: null
  224. # Same as above, but for pinned chats. The favorite tag is called m.favourite
  225. pinned_tag: null
  226. # Should mute status and tags only be bridged when the portal room is created?
  227. tag_only_on_create: true
  228. # Should WhatsApp status messages be bridged into a Matrix room?
  229. # Disabling this won't affect already created status broadcast rooms.
  230. enable_status_broadcast: true
  231. # Should the status broadcast room be muted and moved into low priority by default?
  232. # This is only applied when creating the room, the user can unmute it later.
  233. mute_status_broadcast: true
  234. # Tag to apply to the status broadcast room.
  235. status_broadcast_tag: m.lowpriority
  236. # Should the bridge use thumbnails from WhatsApp?
  237. # They're disabled by default due to very low resolution.
  238. whatsapp_thumbnail: false
  239. # Allow invite permission for user. User can invite any bots to room with whatsapp
  240. # users (private chat and groups)
  241. allow_user_invite: false
  242. # Whether or not created rooms should have federation enabled.
  243. # If false, created portal rooms will never be federated.
  244. federate_rooms: true
  245. # Whether to enable disappearing messages in groups. If enabled, then the expiration time of
  246. # the messages will be determined by the first user to read the message, rather than individually.
  247. # If the bridge only has a single user, this can be turned on safely.
  248. disappearing_messages_in_groups: false
  249. # Should the bridge never send alerts to the bridge management room?
  250. # These are mostly things like the user being logged out.
  251. disable_bridge_alerts: false
  252. # Should the bridge detect URLs in outgoing messages, ask the homeserver to generate a preview,
  253. # and send it to WhatsApp? URL previews can always be sent using the `com.beeper.linkpreviews`
  254. # key in the event content even if this is disabled.
  255. url_previews: false
  256. # The prefix for commands. Only required in non-management rooms.
  257. command_prefix: "!wa"
  258. # Messages sent upon joining a management room.
  259. # Markdown is supported. The defaults are listed below.
  260. management_room_text:
  261. # Sent when joining a room.
  262. welcome: "Hello, I'm a WhatsApp bridge bot."
  263. # Sent when joining a management room and the user is already logged in.
  264. welcome_connected: "Use `help` for help."
  265. # Sent when joining a management room and the user is not logged in.
  266. welcome_unconnected: "Use `help` for help or `login` to log in."
  267. # Optional extra text sent when joining a management room.
  268. additional_help: ""
  269. # End-to-bridge encryption support options.
  270. #
  271. # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
  272. encryption:
  273. # Allow encryption, work in group chat rooms with e2ee enabled
  274. allow: false
  275. # Default to encryption, force-enable encryption in all portals the bridge creates
  276. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  277. # It is recommended to also set private_chat_portal_meta to true when using this.
  278. default: false
  279. # Options for automatic key sharing.
  280. key_sharing:
  281. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  282. # You must use a client that supports requesting keys from other users to use this feature.
  283. allow: false
  284. # Require the requesting device to have a valid cross-signing signature?
  285. # This doesn't require that the bridge has verified the device, only that the user has verified it.
  286. # Not yet implemented.
  287. require_cross_signing: false
  288. # Require devices to be verified by the bridge?
  289. # Verification by the bridge is not yet implemented.
  290. require_verification: true
  291. # Permissions for using the bridge.
  292. # Permitted values:
  293. # relay - Talk through the relaybot (if enabled), no access otherwise
  294. # user - Access to use the bridge to chat with a WhatsApp account.
  295. # admin - User level and some additional administration tools
  296. # Permitted keys:
  297. # * - All Matrix users
  298. # domain - All users on that homeserver
  299. # mxid - Specific user
  300. permissions:
  301. "*": relay
  302. "example.com": user
  303. "@admin:example.com": admin
  304. # Settings for relay mode
  305. relay:
  306. # Whether relay mode should be allowed. If allowed, `!wa set-relay` can be used to turn any
  307. # authenticated user into a relaybot for that chat.
  308. enabled: false
  309. # Should only admins be allowed to set themselves as relay users?
  310. admin_only: true
  311. # The formats to use when sending messages to WhatsApp via the relaybot.
  312. message_formats:
  313. m.text: "<b>{{ .Sender.Displayname }}</b>: {{ .Message }}"
  314. m.notice: "<b>{{ .Sender.Displayname }}</b>: {{ .Message }}"
  315. m.emote: "* <b>{{ .Sender.Displayname }}</b> {{ .Message }}"
  316. m.file: "<b>{{ .Sender.Displayname }}</b> sent a file"
  317. m.image: "<b>{{ .Sender.Displayname }}</b> sent an image"
  318. m.audio: "<b>{{ .Sender.Displayname }}</b> sent an audio file"
  319. m.video: "<b>{{ .Sender.Displayname }}</b> sent a video"
  320. m.location: "<b>{{ .Sender.Displayname }}</b> sent a location"
  321. # Logging config.
  322. logging:
  323. # The directory for log files. Will be created if not found.
  324. directory: ./logs
  325. # Available variables: .Date for the file date and .Index for different log files on the same day.
  326. # Set this to null to disable logging to file.
  327. file_name_format: "{{.Date}}-{{.Index}}.log"
  328. # Date format for file names in the Go time format: https://golang.org/pkg/time/#pkg-constants
  329. file_date_format: "2006-01-02"
  330. # Log file permissions.
  331. file_mode: 0o600
  332. # Timestamp format for log entries in the Go time format.
  333. timestamp_format: "Jan _2, 2006 15:04:05"
  334. # Minimum severity for log messages printed to stdout/stderr. This doesn't affect the log file.
  335. # Options: debug, info, warn, error, fatal
  336. print_level: debug