Webhook

What is a Webhook?

A webhook is an endpoint on your server that DataBeaver can call whenever an entry is submitted, with all of the relevant information for that entry so that your server can perform whatever processing you have setup for it.

Setting up your Webhook

To begin listening for submissions, you need to create a webhook endpoint on your server. The endpoint must be expecting a POST request and should return http status code 200 when the entry is received successfully.

After creating the endpoint, you need to configure it on the settings page in the admin dashboard, under the API Settings tab.

Input the full URL (https strongly recommended) and select the configuration of entries you want to receive:

  • All: This configuration will send entries to your webhook immediately they are submitted by the agent.

  • Accepted/Rejected: This configuration will send entries to your webhook only after they have been accepted/rejected by an admin.

  • Accepted: This configuration will only send accepted entries to your webhook.

  • Rejected: This configuration will only send rejected entries to your webhook.

Sample Payload

This is a sample request body that will be sent to your webhook by DataBeaver whenever an entry is submitted.

{
  "id": "5efdc8210f524412fd1a43de",
  "status": "pending",
  "dispatch": {
    "id": "5ef9cef14ba08a2aac9d0a6c",
    "recipients": {
      "agents": [
        "5efd9b5cda30d50b26c49604",
        "5ef9ceb44ba08a2aac99fd2b"
      ],
      "agentGroups": [
        "5efdc8210f524412fd1a43de"
      ]
    },
    "dispatchType": "basic",
    "status": "dispatched",
    "name": "Test Dispatch",
    "totalExpectedEntries": 1000,
    "createdAt": "2020-07-02T12:34:58.718Z",
    "updatedAt": "2020-07-02T12:34:58.718Z"
  },
  "form": {
    "id": "5efdd95bed83211b2d205139",
    "dispatched": true,
    "status": "active",
    "name": "Test Form",
    "reason": "Testing Webhook",
    "createdAt": "2020-06-29T11:22:24.849Z",
    "updatedAt": "2020-06-29T11:22:24.849Z"
  },
  "project": {
    "id": "5eedef4c8db4fa07ce42a25d",
    "name": "Test Project",
    "modifiedBy": "5ef9ceb44ba08a2aac99fd33",
    "createdAt": "2020-07-02T08:31:24.013Z",
    "updatedAt": "2020-07-02T08:31:24.013Z"
  },
  "agent": {
    "id": "5eedef4c8db4fa07ce42a25c",
    "status": "active",
    "firstName": "Test",
    "lastName": "Agent",
    "email": "testagent@databeaver.co",
    "phone": "08000000000",
    "location": [
      {
        "country": "Nigeria",
        "zone": "South West",
        "state": "Lagos",
        "city": "Lagos"
      }
    ],
    "createdAt": "2020-07-02T11:42:24.861Z",
    "updatedAt": "2020-07-02T11:42:24.861Z"
  },
  "location": {
      "address": "11b Oduduwa Cres, Ikeja GRA, Ikeja, Nigeria",
      "country": "NIGERIA",
      "state": "LAGOS",
      "lga": "Ikeja",
      "city": "Ikeja GRA",
      "coordinates": {
          "longitude": 3.357049,
          "lattitude": 6.574591
      }
  },
  "answers": [
    {
        "type": "singleChoice",
        "question": "What is your state of origin?",
        "answer": "Lagos"
    },
    {
        "type": "multiChoice",
        "question": "Select the pets you have",
        "answer": ["dog", "cat"]
    }
  ],
  "duration": 10,
  "createdAt": "2020-07-02T12:55:54.594Z",
  "updatedAt": "2020-07-02T12:55:54.594Z"
}

Last updated