API | How to create an API watcher and define its schema to meet your requirements

Posted about 1 year ago by Julien Pauthier

Post a topic
  • Pinned Topic
Julien Pauthier
Julien Pauthier Admin

You can apply a specific template to the JSON format of your API watcher to map the data to the JSON properties of your endpoint. You can even use jsonpath expressions to map data to the target schema (checkout the example provided along our Appointments watcher).


Here is an example of a template applied to an Appointments event watcher (creation or update): 


{
  "address": "https://webhook.site/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
  "events": [
    "updated", "created"
  ],
  "schema": {
    "id": "${$.id}",
    "staff": "${$.staff.firstName} ${$.staff.lastName}",
    "firstName": "${$.client.firstName}",
    "lastName": "${$.client.lastName}",
    "email": "${$.client.email}",
    "phone": "${$.client.phone}",
    "datetime": {
      "start": "${$.start.dateTime}",
      "end": "${$.end.dateTime}"
    },
    "appointment": "${$.service.name}"
  },
  "addPreviousData": "false"
}


0 Votes


0 Comments

Login or Sign up to post a comment