arrow-bredcrumbs
Table of Content:

Making calls through an API request

Making calls through an API request

What are webhooks?

Sending JSON webhooks is an efficient way to transfer data from one application to another in real-time. This process involves the use of a webhook URL, which is provided by the receiving application (Brightcall in this case), and acts as a phone number that the other application can call when an event occurs. The data is then sent over the web from the application where the event originally occurred, to the receiving application that handles the data. This data is known as the “payload” and is usually sent in either JSON or XML format.

How to send data with webhooks to trigger a Speed To Lead™ call ?

Our webhook expands on ways you can connect with your leads by turning webforms, shopping carts, or anything you want into an opportunity to be the first to lead.

Now let’s look at some code examples of sending a JSON webhook to Brightcall:

1. Save Brightcall’s request URL and choose if you prefer to submit a GET or POST request.

2. Add keys and values according to the examples below. More info on how to find your personal widget key and API key can be found here → How to get a Widget Key? and How to get an API Key?

👇 JSON Header for POST method




Key



Value

Content-Type

application/json

👇 JSON Body for POST method and minimum required fields




Key



Value

widget_key

%WIDGET_KEY%

api_key

%API_KEY%

lc_number

+1234567890

👇 Example: Combined JSON object for POST method and minimum required fields

'headers': {
     'Content-Type': 'application/json',
},

'body':  {
 'widget_key': '%WIDGET_KEY%', // Widget key
 'api_key': '%API_KEY%', // API key
 'lc_number': '+1234567890' // leads's phone number
}

👇 Example: GET method and minimum required fields

https://app.brightcall.ai/rest/v1/ext/add_call_api/?widget_key={WIDGET_KEY}&api_key={API_KEY}&lc_number={number}

3. Now, you should have all that it takes to trigger a call to Brightcall. But, you can submit additional data from form fields as needed by including optional custom parameters (you can find out more about custom parameters in our dedicated article here):

"headers'": {
  "Content-Type": "application/json",
},

"body": {
    "widget_key": "%WIDGET_KEY%",
    "api_key": "%API_KEY%",
    "lc_number": "+1234567890"
    "lc_param_name": "John Doe", // lead's name
    "lc_param_email": "email@example.com", // lead's email
    "lc_param_message": "Hello, world!", // Message
    "lc_number_2": "+1234567892" // optional lead's second phone number
    "country": "UK" // two letter ISO country code used for local number format conversion, if needed
}

4. If you followed all the steps correctly, you should have a powerful API request ready to impress your leads. Great work! 🎉

Adding agent’s information into a webhook [optional]

Agents can also be defined using our webhook, in case you want to change the regular call queue (set in the widget’s call routing settings) and, for example, send calls to a specific agent who is not part of the call queue.

Add the custom parameters below and fill the fields with the contact information from your agent.

"lc_param_agent05name": "James Smith", "lc_param_agent05phone":"+1234567890"

**lc_param_agent<replace this with your number of choice>name **- custom agent name (e.g. lc_param_agent01name)

**lc_param_agent<use the same number you set in the above field>phone **- custom agent phone (e.g. lc_param_agent01phone). Phone numbers can be with trailing zero or without.

If you have any questions, please email us at support@brightcall.ai

Read next:
Making calls through an API request