JordanChoo / biggie-calls

A severless solution to easily push CallRail calls in BigQuery

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Biggie Calls

Welcome to Biggie Calls! A severless solution to easily save CallRail calls in BigQuery and is developed and maintained by Kogneta.

How It Works

Biggie Calls is deployed as a severless application either on Google Cloud Functions or AWS Lambda. The function's endpoint is then added as a webhook into your CallRail account which is then pinged through a POST request each time a call is completed.

Deploying

To deploy Biggie Calls there are three main steps that need to take place which you can find below:

BigQuery

The first step is to create the a table in BigQuery where each call will be saved. Below is a SQL query that you can copy and paste into BigQuery's console to create the table and the schema.

🚨 Be sure to replace the DATASET_NAME_GOES_HERE field with the name of the BigQuery dataset you'll be using 🚨

    CREATE TABLE IF NOT EXISTS DATASET_NAME_GOES_HERE.RAW_biggie_calls (
        agent_email STRING,
        answered BOOLEAN,
        business_phone_number STRING,
        call_type STRING,
        campaign STRING,
        company_id STRING,
        company_name STRING,
        company_resource_id STRING,
        company_time_zone STRING,
        conversational_transcript STRING,
        created_at DATETIME,
        customer_city STRING,
        customer_country STRING,
        customer_name STRING,
        customer_phone_number STRING,
        customer_state STRING,
        datetime STRING,
        device_type STRING,
        direction STRING,
        duration INT64,
        fbclid STRING,
        first_call BOOLEAN,
        formatted_business_phone_number STRING,
        formatted_call_type STRING,
        formatted_customer_location STRING,
        formatted_customer_name STRING,
        formatted_customer_name_or_phone_number STRING,
        formatted_customer_phone_number STRING,
        formatted_duration STRING,
        formatted_tracking_phone_number STRING,
        formatted_tracking_source STRING,
        formatted_value STRING,
        ga STRING,
        gclid STRING,
        good_lead_call_id INT64,
        good_lead_call_time STRING,
        keywords STRING,
        landing_page_url STRING,
        last_requested_url STRING,
        lead_status STRING,
        medium STRING,
        msclkid STRING,
        note STRING,
        person_resource_id STRING,
        prior_calls INT64,
        recording STRING,
        recording_duration INT64,
        recording_player STRING,
        referrer STRING,
        referrer_domain STRING,
        referring_url STRING,
        resource_id STRING,
        source STRING,
        source_name STRING,
        start_time DATETIME,
        total_calls INT64,
        tracker_resource_id STRING,
        tracking_phone_number STRING,
        transcription STRING,
        utm_campaign STRING,
        utm_content STRING,
        utm_medium STRING,
        utm_source STRING,
        utm_term STRING,
        utma STRING,
        utmb STRING,
        utmc STRING,
        utmv STRING,
        utmz STRING,
        value INT64,
        voicemail BOOLEAN,
        raw_webhook STRING,
    ) PARTITION BY DATE(start_time)

Serverless Function

Once your BigQuery table is configured, you now can deploy your serverless function. For the remainder of this walk-through, we'll be deploying to Google Cloud.

First navigate to Google Cloud functions and start the process of creating a new function.

Step 1: Configuration

Function Name

This will be the name of your function, I recommend calling it biggie-calls but, if you would like to name it something else by all means go ahead.

Trigger

Since we're leveraging CallRails' webhook feature, we need to set the trigger as HTTP and the authentication to Allow unauthenticated invocations with the require HTTPs checked.

Runtime, build, connections and security settings

Clicking the dropdown text named Runtime, build, connections and security settings, you'll be able to add the final configuration options to the Cloud Function.

Runtime
  • Set the Memory allocated to 256MB
  • The Timeout can be set to 60
Runtime Environment Variables

Step 2: Code

Runtime

For the run time environment select Node.js 16 from the dropdown selector.

Entry Point

For the entry point field enter in biggieCalls.

Code

For the code section, simply copy and paste the code from the index.js file in this repository into the code editor found in the code step.

Formatting URL

Once you're done adding all of the information click on the deploy button to deploy the Cloud Function. Once deployed click into it and go to the Trigger tab to get the Trigger URL.

Take the trigger URL and add ?kgKey=YOUR_KGKEY_HERE to the end of it, replacing the YOUR_KGKEY_HERE with the value of your kgKey.

CallRail

Now that your function is deplyed, the next step is to add it to CallRail as a webhook URL to start saving your call data in BigQuery. Follow the instuctions provided by CallRail here and add the modified URL to the Post-Call that contains your kgKey.

Have questions?

If you have any questions feel free to contact me at @JordanChoo.

License

GNU GENERAL PUBLIC LICENSE: https://www.gnu.org/licenses/gpl-3.0-standalone.html

About

A severless solution to easily push CallRail calls in BigQuery

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%