Skip to main content
POST
/
notification
/
v1
/
connect
/
webhook
/
subscriptions
Register Webhook
curl --request POST \
  --url https://api.eka.care/notification/v1/connect/webhook/subscriptions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "endpoint": "https://example.com/webhook",
  "event_names": [
    "appointment.created",
    "appointment.updated",
    "prescription.created",
    "prescription.updated",
    "receipt.created",
    "receipt.updated"
  ],
  "signing_key": "supersecretkey",
  "protocol": "https"
}
'
import requests

url = "https://api.eka.care/notification/v1/connect/webhook/subscriptions"

payload = {
"endpoint": "https://example.com/webhook",
"event_names": ["appointment.created", "appointment.updated", "prescription.created", "prescription.updated", "receipt.created", "receipt.updated"],
"signing_key": "supersecretkey",
"protocol": "https"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
endpoint: 'https://example.com/webhook',
event_names: [
'appointment.created',
'appointment.updated',
'prescription.created',
'prescription.updated',
'receipt.created',
'receipt.updated'
],
signing_key: 'supersecretkey',
protocol: 'https'
})
};

fetch('https://api.eka.care/notification/v1/connect/webhook/subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eka.care/notification/v1/connect/webhook/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'endpoint' => 'https://example.com/webhook',
'event_names' => [
'appointment.created',
'appointment.updated',
'prescription.created',
'prescription.updated',
'receipt.created',
'receipt.updated'
],
'signing_key' => 'supersecretkey',
'protocol' => 'https'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.eka.care/notification/v1/connect/webhook/subscriptions"

payload := strings.NewReader("{\n \"endpoint\": \"https://example.com/webhook\",\n \"event_names\": [\n \"appointment.created\",\n \"appointment.updated\",\n \"prescription.created\",\n \"prescription.updated\",\n \"receipt.created\",\n \"receipt.updated\"\n ],\n \"signing_key\": \"supersecretkey\",\n \"protocol\": \"https\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.eka.care/notification/v1/connect/webhook/subscriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endpoint\": \"https://example.com/webhook\",\n \"event_names\": [\n \"appointment.created\",\n \"appointment.updated\",\n \"prescription.created\",\n \"prescription.updated\",\n \"receipt.created\",\n \"receipt.updated\"\n ],\n \"signing_key\": \"supersecretkey\",\n \"protocol\": \"https\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.eka.care/notification/v1/connect/webhook/subscriptions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"endpoint\": \"https://example.com/webhook\",\n \"event_names\": [\n \"appointment.created\",\n \"appointment.updated\",\n \"prescription.created\",\n \"prescription.updated\",\n \"receipt.created\",\n \"receipt.updated\"\n ],\n \"signing_key\": \"supersecretkey\",\n \"protocol\": \"https\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "7",
  "status": "success"
}
{
"error": {
"message": "requested endpoint is already registered",
"code": "INVALID_REQUEST"
}
}
{
"error": {
"message": "Unauthorized request",
"code": "INVALID_REQUEST"
}
}
{
"error": {
"message": "Internal Server Error",
"code": "SERVER_ERROR"
}
}

Authorizations

Authorization
string
header
required

The API requires a Bearer token in the Authorization header for authentication.

Body

application/json
endpoint
string
required

The fully qualified URL where the webhook will send POST requests. The URL must be reachable by the webhook service.

Example:

"https://example.com/webhook"

event_names
string[]

Specifies the type of events that will trigger the webhook.

  • "appointment.created": Trigger on appointment create events.
  • "user.delete": Trigger on user delete events.
Example:
[
"appointment.created",
"appointment.updated",
"prescription.created",
"prescription.updated",
"receipt.created",
"receipt.updated"
]
signing_key
string

A secret key provided by the client for verifying the authenticity of webhook payloads. It should be a securely generated, random string.

Example:

"supersecretkey"

protocol
string

Specifies the protocol or delivery mechanism used for the webhook.

  • "http": Plain HTTP endpoint.
  • "https": Secure HTTPS endpoint.
  • "SQS endpoint": AWS SQS queue URL for message delivery.
  • "Lambda function": AWS Lambda function ARN for direct invocation.
Example:

"https"

Response

Webhook registered successfully.

id
string

The unique identifier for the webhook.

Example:

"7"

status
string

A message indicating the status of the response.

Example:

"success"