gateway_env.py 1.5 KB

12345678910111213141516171819202122232425262728
  1. """WhatsApp Cloud API env -> gateway config bridge (``PlatformEntry.env_overrides``)."""
  2. from gateway.config import Platform
  3. from gateway.platform_env import INT, EnvCred, home_step
  4. ENV_ENABLE_CREDENTIALS = ("WHATSAPP_CLOUD_PHONE_NUMBER_ID", "WHATSAPP_CLOUD_ACCESS_TOKEN")
  5. # Distinct from the Baileys bridge; both may run against different numbers.
  6. ENV_OVERRIDES = (
  7. EnvCred(
  8. Platform.WHATSAPP_CLOUD, ("WHATSAPP_CLOUD_PHONE_NUMBER_ID", "WHATSAPP_CLOUD_ACCESS_TOKEN"),
  9. fixed=(("phone_number_id", "WHATSAPP_CLOUD_PHONE_NUMBER_ID"), ("access_token", "WHATSAPP_CLOUD_ACCESS_TOKEN")),
  10. optional=(
  11. ("app_id", "WHATSAPP_CLOUD_APP_ID"), ("app_secret", "WHATSAPP_CLOUD_APP_SECRET"),
  12. ("waba_id", "WHATSAPP_CLOUD_WABA_ID"), ("verify_token", "WHATSAPP_CLOUD_VERIFY_TOKEN"),
  13. ("webhook_host", "WHATSAPP_CLOUD_WEBHOOK_HOST"), ("webhook_port", "WHATSAPP_CLOUD_WEBHOOK_PORT", INT),
  14. ("webhook_path", "WHATSAPP_CLOUD_WEBHOOK_PATH"), ("api_version", "WHATSAPP_CLOUD_API_VERSION"),
  15. ),
  16. ),
  17. home_step(Platform.WHATSAPP_CLOUD, "WHATSAPP_CLOUD_HOME_CHANNEL"),
  18. )
  19. # Authorization env names (``PlatformEntry`` fields). Core reads them from this file when the
  20. # live entry lacks them: a user plugin overriding this platform, safe mode, the plugin disabled.
  21. AUTHZ = {
  22. "allowed_users_env": "WHATSAPP_CLOUD_ALLOWED_USERS",
  23. "allow_all_env": "WHATSAPP_CLOUD_ALLOW_ALL_USERS",
  24. "allowlist_suppresses_pairing": True,
  25. }