Zapier - Send Call To Zapier

Created by C B, Modified on Tue, 30 Jan at 10:33 AM by C B

API Documentation for SendCallToZapier Listener and CallResource

Overview

This documentation details the SendCallToZapier event listener in a Laravel application, which is designed to send call data to configured Zapier webhook URLs when a CallCreated event is triggered.

Event: CallCreated

This event is triggered when a new call is created in the system, passing the call data to the SendCallToZapier listener.

Listener: SendCallToZapier

Description

Upon receiving the CallCreated event, the listener retrieves all Zapier webhook URLs based on the user's integration settings and sends the call data to these URLs.

Process Flow

  1. User and Webhook URL Retrieval:

    • Fetches user IDs based on the call's associated client or company.
    • Retrieves Zapier webhook URLs for users with 'new_call' event integration.
    • Input: Call object from the CallCreated event.
    • Output: Array of webhook URLs.
  2. Data Formatting:

    • Formats the call data using the CallResource.
    • Input: Call data from the CallCreated event.
    • Output: JSON formatted call data.
  3. Data Transmission:

    • Sends the formatted data to each retrieved webhook URL via HTTP POST request.
    • Output: HTTP POST requests to each webhook URL.
    • Payload: Formatted call data in JSON.

CallResource

Description

Transforms the call data into a structured JSON format suitable for consumption by the Zapier webhook.

Input

  • Type: Call object from CallCreated event.
  • Fields: Includes various attributes such as IDs, names, phone numbers, and caller details.

Output

  • Type: JSON object.
  • Content: Structured data including call details.

Fields

  • id: Unique identifier of the call.
  • campaign_id: Associated campaign's identifier.
  • campaign_name: Name of the associated campaign.
  • company_id: Identifier of the linked company.
  • company_name: Name of the linked company.
  • client_id: Identifier of the client (nullable).
  • client_name: Name of the client (nullable).
  • campaign_phone_number: Phone number associated with the campaign.
  • campaign_forward_to_phone_number: Forwarding number for the campaign.
  • caller: Object containing the caller's details (name, city, state, zip, phone number).
  • created_at: Timestamp of call creation.

JSON Structure

{
    "id": "int",
    "campaign_id": "int",
    "campaign_name": "string",
    "company_id": "int",
    "company_name": "string",
    "client_id": "int|null",
    "client_name": "string|null",
    "campaign_phone_number": "string",
    "campaign_forward_to_phone_number": "string",
    "caller": {
        "name": "string",
        "city": "string",
        "state": "string",
        "zip": "string",
        "phone_number": "string"
    },
    "created_at": "datetime"
}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article