Vapi · Schema

RegexReplacement

AIVoiceAgentsRealtimeCPaaS

Properties

Name Type Description
type string This is the regex replacement type. You can use this to replace a word or phrase that matches a pattern. Usage: - Replace all numbers with "some number": { type: 'regex', regex: '\\d+', value: 'some n
regex string This is the regex pattern to replace. Note: - This works by using the `string.replace` method in Node.JS. Eg. `"hello there".replace(/hello/g, "hi")` will return `"hi there"`. Hot tip: - In JavaScript
options array These are the options for the regex replacement. Defaults to all disabled. @default []
value string This is the value that will replace the match.
View JSON Schema on GitHub

JSON Schema

vapi-regexreplacement-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/RegexReplacement",
  "title": "RegexReplacement",
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "description": "This is the regex replacement type. You can use this to replace a word or phrase that matches a pattern.\n\nUsage:\n- Replace all numbers with \"some number\": { type: 'regex', regex: '\\\\d+', value: 'some number' }\n- Replace email addresses with \"[EMAIL]\": { type: 'regex', regex: '\\\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Z|a-z]{2,}\\\\b', value: '[EMAIL]' }\n- Replace phone numbers with a formatted version: { type: 'regex', regex: '(\\\\d{3})(\\\\d{3})(\\\\d{4})', value: '($1) $2-$3' }\n- Replace all instances of \"color\" or \"colour\" with \"hue\": { type: 'regex', regex: 'colou?r', value: 'hue' }\n- Capitalize the first letter of every sentence: { type: 'regex', regex: '(?<=\\\\. |^)[a-z]', value: (match) => match.toUpperCase() }",
      "enum": [
        "regex"
      ]
    },
    "regex": {
      "type": "string",
      "description": "This is the regex pattern to replace.\n\nNote:\n- This works by using the `string.replace` method in Node.JS. Eg. `\"hello there\".replace(/hello/g, \"hi\")` will return `\"hi there\"`.\n\nHot tip:\n- In JavaScript, escape `\\` when sending the regex pattern. Eg. `\"hello\\sthere\"` will be sent over the wire as `\"hellosthere\"`. Send `\"hello\\\\sthere\"` instead."
    },
    "options": {
      "description": "These are the options for the regex replacement. Defaults to all disabled.\n\n@default []",
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/RegexOption"
      }
    },
    "value": {
      "type": "string",
      "description": "This is the value that will replace the match.",
      "maxLength": 1000
    }
  },
  "required": [
    "type",
    "regex",
    "value"
  ]
}