{
  "id": "whatsapp",
  "channels": [
    "whatsapp"
  ],
  "configSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "pluginHooks": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "messageReceived": {
            "type": "boolean",
            "description": "Opt in to broadcasting inbound WhatsApp message_received hook payloads to loaded plugins."
          }
        }
      }
    }
  },
  "channelConfigs": {
    "whatsapp": {
      "schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "markdown": {
            "type": "object",
            "properties": {
              "tables": {
                "type": "string",
                "enum": [
                  "off",
                  "bullets",
                  "code",
                  "block"
                ]
              }
            },
            "additionalProperties": false
          },
          "configWrites": {
            "type": "boolean"
          },
          "sendReadReceipts": {
            "type": "boolean"
          },
          "messagePrefix": {
            "type": "string"
          },
          "responsePrefix": {
            "type": "string"
          },
          "dmPolicy": {
            "default": "pairing",
            "type": "string",
            "enum": [
              "pairing",
              "allowlist",
              "open",
              "disabled"
            ]
          },
          "selfChatMode": {
            "type": "boolean"
          },
          "allowFrom": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "defaultTo": {
            "type": "string"
          },
          "groupAllowFrom": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "groupPolicy": {
            "default": "allowlist",
            "type": "string",
            "enum": [
              "open",
              "disabled",
              "allowlist"
            ]
          },
          "contextVisibility": {
            "type": "string",
            "enum": [
              "all",
              "allowlist",
              "allowlist_quote"
            ]
          },
          "historyLimit": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "dmHistoryLimit": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "dms": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "historyLimit": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "additionalProperties": false
            }
          },
          "textChunkLimit": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "chunkMode": {
            "type": "string",
            "enum": [
              "length",
              "newline"
            ]
          },
          "blockStreaming": {
            "type": "boolean"
          },
          "blockStreamingCoalesce": {
            "type": "object",
            "properties": {
              "minChars": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "maxChars": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "idleMs": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "additionalProperties": false
          },
          "groups": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "requireMention": {
                  "type": "boolean"
                },
                "tools": {
                  "type": "object",
                  "properties": {
                    "allow": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "alsoAllow": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "deny": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "additionalProperties": false
                },
                "toolsBySender": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "allow": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "alsoAllow": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "deny": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "systemPrompt": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          },
          "direct": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "systemPrompt": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          },
          "ackReaction": {
            "type": "object",
            "properties": {
              "emoji": {
                "type": "string"
              },
              "direct": {
                "default": true,
                "type": "boolean"
              },
              "group": {
                "default": "mentions",
                "type": "string",
                "enum": [
                  "always",
                  "mentions",
                  "never"
                ]
              }
            },
            "required": [
              "direct",
              "group"
            ],
            "additionalProperties": false
          },
          "reactionLevel": {
            "type": "string",
            "enum": [
              "off",
              "ack",
              "minimal",
              "extensive"
            ]
          },
          "debounceMs": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "replyToMode": {
            "anyOf": [
              {
                "type": "string",
                "const": "off"
              },
              {
                "type": "string",
                "const": "first"
              },
              {
                "type": "string",
                "const": "all"
              },
              {
                "type": "string",
                "const": "batched"
              }
            ]
          },
          "heartbeat": {
            "type": "object",
            "properties": {
              "showOk": {
                "type": "boolean"
              },
              "showAlerts": {
                "type": "boolean"
              },
              "useIndicator": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          },
          "healthMonitor": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          },
          "accounts": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean"
                },
                "capabilities": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "markdown": {
                  "type": "object",
                  "properties": {
                    "tables": {
                      "type": "string",
                      "enum": [
                        "off",
                        "bullets",
                        "code",
                        "block"
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                "configWrites": {
                  "type": "boolean"
                },
                "sendReadReceipts": {
                  "type": "boolean"
                },
                "messagePrefix": {
                  "type": "string"
                },
                "responsePrefix": {
                  "type": "string"
                },
                "dmPolicy": {
                  "type": "string",
                  "enum": [
                    "pairing",
                    "allowlist",
                    "open",
                    "disabled"
                  ]
                },
                "selfChatMode": {
                  "type": "boolean"
                },
                "allowFrom": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "defaultTo": {
                  "type": "string"
                },
                "groupAllowFrom": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "groupPolicy": {
                  "type": "string",
                  "enum": [
                    "open",
                    "disabled",
                    "allowlist"
                  ]
                },
                "contextVisibility": {
                  "type": "string",
                  "enum": [
                    "all",
                    "allowlist",
                    "allowlist_quote"
                  ]
                },
                "historyLimit": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "dmHistoryLimit": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "dms": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "historyLimit": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "textChunkLimit": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "chunkMode": {
                  "type": "string",
                  "enum": [
                    "length",
                    "newline"
                  ]
                },
                "blockStreaming": {
                  "type": "boolean"
                },
                "blockStreamingCoalesce": {
                  "type": "object",
                  "properties": {
                    "minChars": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "maxChars": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "idleMs": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "additionalProperties": false
                },
                "groups": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "requireMention": {
                        "type": "boolean"
                      },
                      "tools": {
                        "type": "object",
                        "properties": {
                          "allow": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "alsoAllow": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "deny": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "additionalProperties": false
                      },
                      "toolsBySender": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "object",
                          "properties": {
                            "allow": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "alsoAllow": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "deny": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "systemPrompt": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "direct": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "systemPrompt": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "ackReaction": {
                  "type": "object",
                  "properties": {
                    "emoji": {
                      "type": "string"
                    },
                    "direct": {
                      "default": true,
                      "type": "boolean"
                    },
                    "group": {
                      "default": "mentions",
                      "type": "string",
                      "enum": [
                        "always",
                        "mentions",
                        "never"
                      ]
                    }
                  },
                  "required": [
                    "direct",
                    "group"
                  ],
                  "additionalProperties": false
                },
                "reactionLevel": {
                  "type": "string",
                  "enum": [
                    "off",
                    "ack",
                    "minimal",
                    "extensive"
                  ]
                },
                "debounceMs": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "replyToMode": {
                  "anyOf": [
                    {
                      "type": "string",
                      "const": "off"
                    },
                    {
                      "type": "string",
                      "const": "first"
                    },
                    {
                      "type": "string",
                      "const": "all"
                    },
                    {
                      "type": "string",
                      "const": "batched"
                    }
                  ]
                },
                "heartbeat": {
                  "type": "object",
                  "properties": {
                    "showOk": {
                      "type": "boolean"
                    },
                    "showAlerts": {
                      "type": "boolean"
                    },
                    "useIndicator": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                },
                "healthMonitor": {
                  "type": "object",
                  "properties": {
                    "enabled": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                },
                "name": {
                  "type": "string"
                },
                "authDir": {
                  "type": "string"
                },
                "mediaMaxMb": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "additionalProperties": false
            }
          },
          "defaultAccount": {
            "type": "string"
          },
          "mediaMaxMb": {
            "default": 50,
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "actions": {
            "type": "object",
            "properties": {
              "reactions": {
                "type": "boolean"
              },
              "sendMessage": {
                "type": "boolean"
              },
              "polls": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "dmPolicy",
          "groupPolicy",
          "debounceMs",
          "mediaMaxMb"
        ],
        "additionalProperties": false
      },
      "label": "WhatsApp",
      "description": "works with your own number; recommend a separate phone + eSIM.",
      "uiHints": {
        "": {
          "label": "WhatsApp",
          "help": "WhatsApp channel provider configuration for access policy and message batching behavior. Use this section to tune responsiveness and direct-message routing safety for WhatsApp chats."
        },
        "dmPolicy": {
          "label": "WhatsApp DM Policy",
          "help": "Direct message access control (\"pairing\" recommended). \"open\" requires channels.whatsapp.allowFrom=[\"*\"]."
        },
        "selfChatMode": {
          "label": "WhatsApp Self-Phone Mode",
          "help": "Same-phone setup (bot uses your personal WhatsApp number)."
        },
        "debounceMs": {
          "label": "WhatsApp Message Debounce (ms)",
          "help": "Debounce window (ms) for batching rapid consecutive messages from the same sender (0 to disable)."
        },
        "configWrites": {
          "label": "WhatsApp Config Writes",
          "help": "Allow WhatsApp to write config in response to channel events/commands (default: true)."
        }
      }
    }
  }
}
