example-config.yaml 13 KB

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