example-config.yaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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. # The URL to push real-time bridge status to.
  8. # If set, the bridge will make POST requests to this URL whenever a user's whatsapp connection state changes.
  9. # The bridge will use the appservice as_token to authorize requests.
  10. status_endpoint: null
  11. # Application service host/registration related details.
  12. # Changing these values requires regeneration of the registration.
  13. appservice:
  14. # The address that the homeserver can use to connect to this appservice.
  15. address: http://localhost:29318
  16. # The hostname and port where this appservice should listen.
  17. hostname: 0.0.0.0
  18. port: 29318
  19. # Database config.
  20. database:
  21. # The database type. "sqlite3" and "postgres" are supported.
  22. type: sqlite3
  23. # The database URI.
  24. # SQLite: File name is enough. https://github.com/mattn/go-sqlite3#connection-string
  25. # Postgres: Connection string. For example, postgres://user:password@host/database?sslmode=disable
  26. uri: mautrix-whatsapp.db
  27. # Maximum number of connections. Mostly relevant for Postgres.
  28. max_open_conns: 20
  29. max_idle_conns: 2
  30. # Settings for provisioning API
  31. provisioning:
  32. # Prefix for the provisioning API paths.
  33. prefix: /_matrix/provision/v1
  34. # Shared secret for authentication. If set to "disable", the provisioning API will be disabled.
  35. shared_secret: disable
  36. # The unique ID of this appservice.
  37. id: whatsapp
  38. # Appservice bot details.
  39. bot:
  40. # Username of the appservice bot.
  41. username: whatsappbot
  42. # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
  43. # to leave display name/avatar as-is.
  44. displayname: WhatsApp bridge bot
  45. avatar: mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr
  46. # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
  47. as_token: "This value is generated when generating the registration"
  48. hs_token: "This value is generated when generating the registration"
  49. metrics:
  50. # Whether or not to enable prometheus metrics
  51. enabled: false
  52. # IP and port where the metrics listener should be. The path is always /metrics
  53. listen: 127.0.0.1:8001
  54. whatsapp:
  55. # Device name that's shown in the "WhatsApp Web" section in the mobile app.
  56. os_name: Mautrix-WhatsApp bridge
  57. # Browser name that determines the logo shown in the mobile app. If the name is unrecognized, a generic icon is shown.
  58. # Use the name of an actual browser (Chrome, Firefox, Safari, IE, Edge, Opera) if you want a specific icon.
  59. browser_name: mx-wa
  60. # Bridge config
  61. bridge:
  62. # Localpart template of MXIDs for WhatsApp users.
  63. # {{.}} is replaced with the phone number of the WhatsApp user.
  64. username_template: whatsapp_{{.}}
  65. # Displayname template for WhatsApp users.
  66. # {{.Notify}} - nickname set by the WhatsApp user
  67. # {{.Jid}} - phone number (international format)
  68. # The following variables are also available, but will cause problems on multi-user instances:
  69. # {{.Name}} - display name from contact list
  70. # {{.Short}} - short display name from contact list
  71. # To use multiple if's, you need to use: {{else if .Name}}, for example:
  72. # "{{if .Notify}}{{.Notify}}{{else if .Name}}{{.Name}}{{else}}{{.Jid}}{{end}} (WA)"
  73. displayname_template: "{{if .Notify}}{{.Notify}}{{else}}{{.Jid}}{{end}} (WA)"
  74. # Localpart template for per-user room grouping community IDs.
  75. # On startup, the bridge will try to create these communities, add all of the specific user's
  76. # portals to the community, and invite the Matrix user to it.
  77. # (Note that, by default, non-admins might not have your homeserver's permission to create
  78. # communities.)
  79. # {{.Localpart}} is the MXID localpart and {{.Server}} is the MXID server part of the user.
  80. # whatsapp_{{.Localpart}}={{.Server}} is a good value that should work for any user.
  81. community_template: null
  82. # WhatsApp connection timeout in seconds.
  83. connection_timeout: 20
  84. # If WhatsApp doesn't respond within connection_timeout, should the bridge try to fetch the message
  85. # to see if it was actually bridged? Use this if you have problems with sends timing out but actually
  86. # succeeding.
  87. fetch_message_on_timeout: false
  88. # Whether or not the bridge should send a read receipt from the bridge bot when a message has been
  89. # sent to WhatsApp. If fetch_message_on_timeout is enabled, a successful post-timeout fetch will
  90. # trigger a read receipt too.
  91. delivery_receipts: false
  92. # Maximum number of times to retry connecting on connection error.
  93. max_connection_attempts: 3
  94. # Number of seconds to wait between connection attempts.
  95. # Negative numbers are exponential backoff: -connection_retry_delay + 1 + 2^attempts
  96. connection_retry_delay: -1
  97. # Whether or not the bridge should send a notice to the user's management room when it retries connecting.
  98. # If false, it will only report when it stops retrying.
  99. report_connection_retry: true
  100. # Whether or not the bridge should reconnect even if WhatsApp says another web client connected.
  101. aggressive_reconnect: false
  102. # Maximum number of seconds to wait for chats to be sent at startup.
  103. # If this is too low and you have lots of chats, it could cause backfilling to fail.
  104. chat_list_wait: 30
  105. # Maximum number of seconds to wait to sync portals before force unlocking message processing.
  106. # If this is too low and you have lots of chats, it could cause backfilling to fail.
  107. portal_sync_wait: 600
  108. user_message_buffer: 1024
  109. portal_message_buffer: 128
  110. # Whether or not to send call start/end notices to Matrix.
  111. call_notices:
  112. start: true
  113. end: true
  114. # Number of chats to sync for new users.
  115. initial_chat_sync_count: 10
  116. # Number of old messages to fill when creating new portal rooms.
  117. initial_history_fill_count: 20
  118. # Whether or not notifications should be turned off while filling initial history.
  119. # Only applicable when using double puppeting.
  120. initial_history_disable_notifications: false
  121. # Maximum number of chats to sync when recovering from downtime.
  122. # Set to -1 to sync all new chats during downtime.
  123. recovery_chat_sync_limit: -1
  124. # Whether or not to sync history when recovering from downtime.
  125. recovery_history_backfill: true
  126. # Whether or not portal info should be fetched from the server when syncing,
  127. # instead of relying on finding any changes in the message history.
  128. # If you get 599 errors often, you should try disabling this.
  129. chat_meta_sync: true
  130. # Whether or not puppet avatars should be fetched from the server even if an avatar is already set.
  131. # If you get 599 errors often, you should try disabling this.
  132. user_avatar_sync: true
  133. # Whether or not Matrix users leaving groups should be bridged to WhatsApp
  134. bridge_matrix_leave: true
  135. # Maximum number of seconds since last message in chat to skip
  136. # syncing the chat in any case. This setting will take priority
  137. # over both recovery_chat_sync_limit and initial_chat_sync_count.
  138. # Default is 3 days = 259200 seconds
  139. sync_max_chat_age: 259200
  140. # Whether or not to sync with custom puppets to receive EDUs that
  141. # are not normally sent to appservices.
  142. sync_with_custom_puppets: true
  143. # Whether or not to update the m.direct account data event when double puppeting is enabled.
  144. # Note that updating the m.direct event is not atomic (except with mautrix-asmux)
  145. # and is therefore prone to race conditions.
  146. sync_direct_chat_list: false
  147. # When double puppeting is enabled, users can use `!wa toggle` to change whether or not
  148. # presence and read receipts are bridged. These settings set the default values.
  149. # Existing users won't be affected when these are changed.
  150. default_bridge_receipts: true
  151. default_bridge_presence: true
  152. # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
  153. #
  154. # If set, custom puppets will be enabled automatically for local users
  155. # instead of users having to find an access token and run `login-matrix`
  156. # manually.
  157. login_shared_secret: null
  158. # Whether or not to invite own WhatsApp user's Matrix puppet into private
  159. # chat portals when backfilling if needed.
  160. # This always uses the default puppet instead of custom puppets due to
  161. # rate limits and timestamp massaging.
  162. invite_own_puppet_for_backfilling: true
  163. # Whether or not to explicitly set the avatar and room name for private
  164. # chat portal rooms. This can be useful if the previous field works fine,
  165. # but causes room avatar/name bugs.
  166. private_chat_portal_meta: false
  167. # Whether or not Matrix m.notice-type messages should be bridged.
  168. bridge_notices: true
  169. # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
  170. # This field will automatically be changed back to false after it,
  171. # except if the config file is not writable.
  172. resend_bridge_info: false
  173. # When using double puppeting, should muted chats be muted in Matrix?
  174. mute_bridging: false
  175. # When using double puppeting, should archived chats be moved to a specific tag in Matrix?
  176. # Note that WhatsApp unarchives chats when a message is received, which will also be mirrored to Matrix.
  177. # This can be set to a tag (e.g. m.lowpriority), or null to disable.
  178. archive_tag: null
  179. # Same as above, but for pinned chats. The favorite tag is called m.favourite
  180. pinned_tag: null
  181. # Whether or not mute status and tags should only be bridged when the portal room is created.
  182. tag_only_on_create: true
  183. # Whether or not WhatsApp status messages should be bridged into a Matrix room.
  184. # Disabling this won't affect already created status broadcast rooms.
  185. enable_status_broadcast: true
  186. # Whether or not thumbnails from WhatsApp should be sent.
  187. # They're disabled by default due to very low resolution.
  188. whatsapp_thumbnail: false
  189. # Allow invite permission for user. User can invite any bots to room with whatsapp
  190. # users (private chat and groups)
  191. allow_user_invite: false
  192. # The prefix for commands. Only required in non-management rooms.
  193. command_prefix: "!wa"
  194. # End-to-bridge encryption support options. This requires login_shared_secret to be configured
  195. # in order to get a device for the bridge bot.
  196. #
  197. # Additionally, https://github.com/matrix-org/synapse/pull/5758 is required if using a normal
  198. # application service.
  199. encryption:
  200. # Allow encryption, work in group chat rooms with e2ee enabled
  201. allow: false
  202. # Default to encryption, force-enable encryption in all portals the bridge creates
  203. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  204. # It is recommended to also set private_chat_portal_meta to true when using this.
  205. default: false
  206. # Options for automatic key sharing.
  207. key_sharing:
  208. # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
  209. # You must use a client that supports requesting keys from other users to use this feature.
  210. allow: false
  211. # Require the requesting device to have a valid cross-signing signature?
  212. # This doesn't require that the bridge has verified the device, only that the user has verified it.
  213. # Not yet implemented.
  214. require_cross_signing: false
  215. # Require devices to be verified by the bridge?
  216. # Verification by the bridge is not yet implemented.
  217. require_verification: true
  218. # Permissions for using the bridge.
  219. # Permitted values:
  220. # relaybot - Talk through the relaybot (if enabled), no access otherwise
  221. # user - Access to use the bridge to chat with a WhatsApp account.
  222. # admin - User level and some additional administration tools
  223. # Permitted keys:
  224. # * - All Matrix users
  225. # domain - All users on that homeserver
  226. # mxid - Specific user
  227. permissions:
  228. "*": relaybot
  229. "example.com": user
  230. "@admin:example.com": admin
  231. relaybot:
  232. # Whether or not relaybot support is enabled.
  233. enabled: false
  234. # The management room for the bot. This is where all status notifications are posted and
  235. # in this room, you can use `!wa <command>` instead of `!wa relaybot <command>`. Omitting
  236. # the command prefix completely like in user management rooms is not possible.
  237. management: "!foo:example.com"
  238. # List of users to invite to all created rooms that include the relaybot.
  239. invites: []
  240. # The formats to use when sending messages to WhatsApp via the relaybot.
  241. message_formats:
  242. m.text: "<b>{{ .Sender.Displayname }}</b>: {{ .Message }}"
  243. m.notice: "<b>{{ .Sender.Displayname }}</b>: {{ .Message }}"
  244. m.emote: "* <b>{{ .Sender.Displayname }}</b> {{ .Message }}"
  245. m.file: "<b>{{ .Sender.Displayname }}</b> sent a file"
  246. m.image: "<b>{{ .Sender.Displayname }}</b> sent an image"
  247. m.audio: "<b>{{ .Sender.Displayname }}</b> sent an audio file"
  248. m.video: "<b>{{ .Sender.Displayname }}</b> sent a video"
  249. m.location: "<b>{{ .Sender.Displayname }}</b> sent a location"
  250. # Logging config.
  251. logging:
  252. # The directory for log files. Will be created if not found.
  253. directory: ./logs
  254. # Available variables: .Date for the file date and .Index for different log files on the same day.
  255. file_name_format: "{{.Date}}-{{.Index}}.log"
  256. # Date format for file names in the Go time format: https://golang.org/pkg/time/#pkg-constants
  257. file_date_format: 2006-01-02
  258. # Log file permissions.
  259. file_mode: 0600
  260. # Timestamp format for log entries in the Go time format.
  261. timestamp_format: Jan _2, 2006 15:04:05
  262. # Minimum severity for log messages.
  263. # Options: debug, info, warn, error, fatal
  264. print_level: debug