Skip to main content

Endpoint

GET https://{yourserver}/webhooks/call This webhook is sent when a new call is created on the platform. It is configured at the application level. Parameters are passed as query string. Reference: Call Hook (GET)

Query parameters

ParameterTypeRequiredDescription
call_sidstringYesUnique identifier for the call
application_sidstringYesUnique identifier for the Graine application controlling this call
account_sidstringYesUnique identifier for the Graine account
directionstringYesinbound or outbound
fromstringYesCalling party number
tostringYesCalled party number
caller_namestringYesCaller name, if known
call_statusstringYesOne of: trying, ringing, early-media, in-progress, completed, failed, busy, no-answer
sip_statusnumberYesMost recent SIP status code for the call

Response

Return a 200 with a JSON payload consisting of an array of verbs to control the call.

Authentication

Authorization: Basic authentication (required)

Example request

import requests

url = "https://{yourserver}/webhooks/call"

querystring = {
    "call_sid": "d2515c3b-b79a-41a2-971a-445e769c823c",
    "application_sid": "72c5c38f-9bba-40ce-aa83-aaa6be55e1b5",
    "account_sid": "bad98250-b34d-459d-9e90-f97dfb9bc519",
    "direction": "inbound",
    "from": "+12125551212",
    "to": "+14155551234",
    "caller_name": "John Doe",
    "call_status": "trying",
    "sip_status": "100"
}
headers = {"Authorization": "Basic <username>:<password>"}

response = requests.get(url, headers=headers, params=querystring)
print(response.json())
const params = new URLSearchParams({
  call_sid: 'd2515c3b-b79a-41a2-971a-445e769c823c',
  application_sid: '72c5c38f-9bba-40ce-aa83-aaa6be55e1b5',
  account_sid: 'bad98250-b34d-459d-9e90-f97dfb9bc519',
  direction: 'inbound',
  from: '+12125551212',
  to: '+14155551234',
  caller_name: 'John Doe',
  call_status: 'trying',
  sip_status: '100'
});
const url = `https://{yourserver}/webhooks/call?${params}`;
const options = { method: 'GET', headers: { Authorization: 'Basic <username>:<password>' } };

const response = await fetch(url, options);
const data = await response.json();
console.log(data);