example-config.yaml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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. # Application service host/registration related details.
  16. # Changing these values requires regeneration of the registration.
  17. appservice:
  18. # The address that the homeserver can use to connect to this appservice.
  19. address: http://localhost:29318
  20. # The hostname and port where this appservice should listen.
  21. hostname: 0.0.0.0
  22. port: 29318
  23. # Database config.
  24. database:
  25. # The database type. "sqlite3" and "postgres" are supported.
  26. type: sqlite3
  27. # The database URI.
  28. # SQLite: File name is enough. https://github.com/mattn/go-sqlite3#connection-string
  29. # Postgres: Connection string. For example, postgres://user:password@host/database?sslmode=disable
  30. # To connect via Unix socket, use something like postgres:///dbname?host=/var/run/postgresql
  31. uri: mautrix-whatsapp.db
  32. # Maximum number of connections. Mostly relevant for Postgres.
  33. max_open_conns: 20
  34. max_idle_conns: 2
  35. # Maximum connection idle time and lifetime before they're closed. Disabled if null.
  36. # Parsed with https://pkg.go.dev/time#ParseDuration
  37. max_conn_idle_time: null
  38. max_conn_lifetime: null
  39. # Settings for provisioning API
  40. provisioning:
  41. # Prefix for the provisioning API paths.
  42. prefix: /_matrix/provision
  43. # Shared secret for authentication. If set to "generate", a random secret will be generated,
  44. # or if set to "disable", the provisioning API will be disabled.
  45. shared_secret: generate
  46. # Segment API key to enable analytics tracking for web server
  47. # endpoints. Set to null to disable.
  48. # Currently the only events are login start, QR code retrieve, and login
  49. # success/failure.
  50. segment_key: null
  51. # The unique ID of this appservice.
  52. id: whatsapp
  53. # Appservice bot details.
  54. bot:
  55. # Username of the appservice bot.
  56. username: whatsappbot
  57. # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
  58. # to leave display name/avatar as-is.
  59. displayname: WhatsApp bridge bot
  60. avatar: mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr
  61. # Whether or not to receive ephemeral events via appservice transactions.
  62. # Requires MSC2409 support (i.e. Synapse 1.22+).
  63. # You should disable bridge -> sync_with_custom_puppets when this is enabled.
  64. ephemeral_events: false
  65. # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
  66. as_token: "This value is generated when generating the registration"
  67. hs_token: "This value is generated when generating the registration"
  68. # Prometheus config.
  69. metrics:
  70. # Enable prometheus metrics?
  71. enabled: false
  72. # IP and port where the metrics listener should be. The path is always /metrics
  73. listen: 127.0.0.1:8001
  74. # Config for things that are directly sent to WhatsApp.
  75. whatsapp:
  76. # Device name that's shown in the "WhatsApp Web" section in the mobile app.
  77. os_name: Mautrix-WhatsApp bridge
  78. # Browser name that determines the logo shown in the mobile app.
  79. # Must be "unknown" for a generic icon or a valid browser name if you want a specific icon.
  80. # List of valid browser names: https://github.com/tulir/whatsmeow/blob/2a72655ef600a7fd7a2e98d53ec6da029759c4b8/binary/proto/def.proto#L1582-L1594
  81. browser_name: unknown
  82. # Bridge config
  83. bridge:
  84. # Localpart template of MXIDs for WhatsApp users.
  85. # {{.}} is replaced with the phone number of the WhatsApp user.
  86. username_template: whatsapp_{{.}}
  87. # Displayname template for WhatsApp users.
  88. # {{.PushName}} - nickname set by the WhatsApp user
  89. # {{.BusinessName}} - validated WhatsApp business name
  90. # {{.Phone}} - phone number (international format)
  91. # The following variables are also available, but will cause problems on multi-user instances:
  92. # {{.FullName}} - full name from contact list
  93. # {{.FirstName}} - first name from contact list
  94. displayname_template: "{{if .PushName}}{{.PushName}}{{else if .BusinessName}}{{.BusinessName}}{{else}}{{.JID}}{{end}} (WA)"
  95. # Should the bridge create a space for each logged-in user and add bridged rooms to it?
  96. # Users who logged in before turning this on should run `!wa sync space` to create and fill the space for the first time.
  97. personal_filtering_spaces: false
  98. # Should the bridge send a read receipt from the bridge bot when a message has been sent to WhatsApp?
  99. delivery_receipts: false
  100. # Should incoming calls send a message to the Matrix room?
  101. call_start_notices: true
  102. # Should another user's cryptographic identity changing send a message to Matrix?
  103. identity_change_notices: false
  104. portal_message_buffer: 128
  105. # Settings for handling history sync payloads. These settings only apply right after login,
  106. # because the phone only sends the history sync data once, and there's no way to re-request it
  107. # (other than logging out and back in again).
  108. history_sync:
  109. # Should the bridge create portals for chats in the history sync payload?
  110. create_portals: true
  111. # Maximum age of chats in seconds to create portals for. Set to 0 to create portals for all chats in sync payload.
  112. max_age: 604800
  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 puppet avatars be fetched from the server even if an avatar is already set?
  128. user_avatar_sync: true
  129. # Should Matrix users leaving groups be bridged to WhatsApp?
  130. bridge_matrix_leave: true
  131. # Should the bridge sync with double puppeting to receive EDUs that aren't normally sent to appservices.
  132. sync_with_custom_puppets: true
  133. # Should the bridge update the m.direct account data event when double puppeting is enabled.
  134. # Note that updating the m.direct event is not atomic (except with mautrix-asmux)
  135. # and is therefore prone to race conditions.
  136. sync_direct_chat_list: false
  137. # When double puppeting is enabled, users can use `!wa toggle` to change whether
  138. # presence and read receipts are bridged. These settings set the default values.
  139. # Existing users won't be affected when these are changed.
  140. default_bridge_receipts: true
  141. default_bridge_presence: true
  142. # Send the presence as "available" to whatsapp when users start typing on a portal.
  143. # This works as a workaround for homeservers that do not support presence, and allows
  144. # users to see when the whatsapp user on the other side is typing during a conversation.
  145. send_presence_on_typing: false
  146. # Should the bridge always send "active" delivery receipts (two gray ticks on WhatsApp)
  147. # even if the user isn't marked as online (e.g. when presence bridging isn't enabled)?
  148. #
  149. # By default, the bridge acts like WhatsApp web, which only sends active delivery
  150. # receipts when it's in the foreground.
  151. force_active_delivery_receipts: false
  152. # Servers to always allow double puppeting from
  153. double_puppet_server_map:
  154. example.com: https://example.com
  155. # Allow using double puppeting from any server with a valid client .well-known file.
  156. double_puppet_allow_discovery: false
  157. # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
  158. #
  159. # If set, double puppeting will be enabled automatically for local users
  160. # instead of users having to find an access token and run `login-matrix`
  161. # manually.
  162. login_shared_secret_map:
  163. example.com: foobar
  164. # Should the bridge explicitly set the avatar and room name for private chat portal rooms?
  165. private_chat_portal_meta: false
  166. # Should Matrix m.notice-type messages be bridged?
  167. bridge_notices: true
  168. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  169. # This field will automatically be changed back to false after it, except if the config file is not writable.
  170. resend_bridge_info: false
  171. # When using double puppeting, should muted chats be muted in Matrix?
  172. mute_bridging: false
  173. # When using double puppeting, should archived chats be moved to a specific tag in Matrix?
  174. # Note that WhatsApp unarchives chats when a message is received, which will also be mirrored to Matrix.
  175. # This can be set to a tag (e.g. m.lowpriority), or null to disable.
  176. archive_tag: null
  177. # Same as above, but for pinned chats. The favorite tag is called m.favourite
  178. pinned_tag: null
  179. # Should mute status and tags only be bridged when the portal room is created?
  180. tag_only_on_create: true
  181. # Should WhatsApp status messages be bridged into a Matrix room?
  182. # Disabling this won't affect already created status broadcast rooms.
  183. enable_status_broadcast: true
  184. # Should the status broadcast room be muted and moved into low priority by default?
  185. # This is only applied when creating the room, the user can unmute/untag it later.
  186. mute_status_broadcast: true
  187. # Should the bridge use thumbnails from WhatsApp?
  188. # They're disabled by default due to very low resolution.
  189. whatsapp_thumbnail: false
  190. # Allow invite permission for user. User can invite any bots to room with whatsapp
  191. # users (private chat and groups)
  192. allow_user_invite: false
  193. # Whether or not created rooms should have federation enabled.
  194. # If false, created portal rooms will never be federated.
  195. federate_rooms: true
  196. # Whether to enable disappearing messages in groups. If enabled, then the expiration time of
  197. # the messages will be determined by the first user to read the message, rather than individually.
  198. # If the bridge only has a single user, this can be turned on safely.
  199. disappearing_messages_in_groups: false
  200. # Should the bridge never send alerts to the bridge management room?
  201. # These are mostly things like the user being logged out.
  202. disable_bridge_alerts: false
  203. # Should the bridge detect URLs in outgoing messages, ask the homeserver to generate a preview,
  204. # and send it to WhatsApp? URL previews can always be sent using the `com.beeper.linkpreviews`
  205. # key in the event content even if this is disabled.
  206. url_previews: false
  207. # The prefix for commands. Only required in non-management rooms.
  208. command_prefix: "!wa"
  209. # Messages sent upon joining a management room.
  210. # Markdown is supported. The defaults are listed below.
  211. management_room_text:
  212. # Sent when joining a room.
  213. welcome: "Hello, I'm a WhatsApp bridge bot."
  214. # Sent when joining a management room and the user is already logged in.
  215. welcome_connected: "Use `help` for help."
  216. # Sent when joining a management room and the user is not logged in.
  217. welcome_unconnected: "Use `help` for help or `login` to log in."
  218. # Optional extra text sent when joining a management room.
  219. additional_help: ""
  220. # End-to-bridge encryption support options.
  221. #
  222. # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
  223. encryption:
  224. # Allow encryption, work in group chat rooms with e2ee enabled
  225. allow: false
  226. # Default to encryption, force-enable encryption in all portals the bridge creates
  227. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  228. # It is recommended to also set private_chat_portal_meta to true when using this.
  229. default: false
  230. # Options for automatic key sharing.
  231. key_sharing:
  232. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  233. # You must use a client that supports requesting keys from other users to use this feature.
  234. allow: false
  235. # Require the requesting device to have a valid cross-signing signature?
  236. # This doesn't require that the bridge has verified the device, only that the user has verified it.
  237. # Not yet implemented.
  238. require_cross_signing: false
  239. # Require devices to be verified by the bridge?
  240. # Verification by the bridge is not yet implemented.
  241. require_verification: true
  242. # Permissions for using the bridge.
  243. # Permitted values:
  244. # relay - Talk through the relaybot (if enabled), no access otherwise
  245. # user - Access to use the bridge to chat with a WhatsApp account.
  246. # admin - User level and some additional administration tools
  247. # Permitted keys:
  248. # * - All Matrix users
  249. # domain - All users on that homeserver
  250. # mxid - Specific user
  251. permissions:
  252. "*": relay
  253. "example.com": user
  254. "@admin:example.com": admin
  255. # Settings for relay mode
  256. relay:
  257. # Whether relay mode should be allowed. If allowed, `!wa set-relay` can be used to turn any
  258. # authenticated user into a relaybot for that chat.
  259. enabled: false
  260. # Should only admins be allowed to set themselves as relay users?
  261. admin_only: true
  262. # The formats to use when sending messages to WhatsApp via the relaybot.
  263. message_formats:
  264. m.text: "<b>{{ .Sender.Displayname }}</b>: {{ .Message }}"
  265. m.notice: "<b>{{ .Sender.Displayname }}</b>: {{ .Message }}"
  266. m.emote: "* <b>{{ .Sender.Displayname }}</b> {{ .Message }}"
  267. m.file: "<b>{{ .Sender.Displayname }}</b> sent a file"
  268. m.image: "<b>{{ .Sender.Displayname }}</b> sent an image"
  269. m.audio: "<b>{{ .Sender.Displayname }}</b> sent an audio file"
  270. m.video: "<b>{{ .Sender.Displayname }}</b> sent a video"
  271. m.location: "<b>{{ .Sender.Displayname }}</b> sent a location"
  272. # Logging config.
  273. logging:
  274. # The directory for log files. Will be created if not found.
  275. directory: ./logs
  276. # Available variables: .Date for the file date and .Index for different log files on the same day.
  277. # Set this to null to disable logging to file.
  278. file_name_format: "{{.Date}}-{{.Index}}.log"
  279. # Date format for file names in the Go time format: https://golang.org/pkg/time/#pkg-constants
  280. file_date_format: "2006-01-02"
  281. # Log file permissions.
  282. file_mode: 0o600
  283. # Timestamp format for log entries in the Go time format.
  284. timestamp_format: "Jan _2, 2006 15:04:05"
  285. # Minimum severity for log messages printed to stdout/stderr. This doesn't affect the log file.
  286. # Options: debug, info, warn, error, fatal
  287. print_level: debug