example-config.yaml 13 KB

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