loading

Setting Up and Receiving Post-Call Webhooks from Answering AI

Introduction

Webhooks allow different applications to share information in real-time. In telephony, especially with services like Answering AI, post-call webhooks can be invaluable for immediate insights after a call concludes. This tutorial will guide you through both the setup and the detailed interpretation of post-call webhooks from Answering AI.

1. Setting Up the Webhook in Answering AI

  • Log into Answering AI: Start by accessing your Answering AI dashboard.

  • Go to Plugins: Within the dashboard, navigate to the 'Plugins' section.

  • Enable 'Take Message' Plugin: Locate and activate the "take message" plugin.

  • Configure Webhook URL: Once activated, you'll be prompted to enter the webhook URL where Answering AI should send the post-call data.

2. Decoding the Post-Call JSON Structure

The data dispatched by Answering AI is structured as JSON. This is an example Webhook payload:

 {
    "call_id": "35a85d6f-8f5e-40b8-9b17-e0b7d8e5e9c1",
    "phone_number_id": "6c5f1c24-a5b1-4e70-8e76-3db2f1a56c8c",
    "call_from": "+1234567890",
    "ai_summary": {
      "subject": "Call about demo service inquiry",
      "language": "en",
      "content": "The user John Doe called to inquire about our demo services. I explained our generic process. He agreed to a callback from one of our representatives to discuss further.",
      "caller_name": "John Doe",
      "phone_number_given_by_user": "+1234567890",
      "phone_number_caller_id": "+1234567890",
      "includes_inappropriate_content": false,
      "transcription": "Phone call from +1234567890. Caller: How does your service work? AI Receptionist: We provide generic services. Caller: Thank you, I'll await a callback.",
      "duration_ai": 78,
      "duration_redirection": 0,
      "intake_forms": [
        {
          "form_id": "2b1f8a9e-9c0f-42b0-a313-8f0b7a6a4d2c",
          "form_type": "Demo Service Inquiry",
          "form_content": {
            "What is your name?": "John Doe",
            "Size of your company": "10 Employees"
          }
        }
      ]
    }
  }


Here’s a detailed breakdown:

  • call_id: A unique identifier for each call.

  • phone_number_id: An ID associated with the specific phone number involved in the call.

  • call_from: The originating phone number of the call.

  • ai_summary: Contains AI-processed details or an error status:

    • When successful:

      • subject: Central theme or topic of the call.

      • language: Language in which the conversation occurred.

      • content: A concise summary or description of the call's contents.

      • caller_name: Name of the person initiating the call.

      • phone_number_given_by_user: Phone number provided during the conversation.

      • phone_number_caller_id: Caller ID detected phone number.

      • includes_inappropriate_content: Boolean indicating any inappropriate content in the call.

      • transcription: A textual transcription of the entire call.

      • duration_ai: Duration (in seconds) of the AI's handling of the call.

      • duration_redirection: Duration (in seconds) of any redirection that occurred during the call.

      • intake_forms: An array detailing forms engaged during the call. Each form contains:

        • form_id: Unique identifier for the form.

        • form_type: Descriptive type or category of the form.

        • form_content: Questions and their corresponding answers filled out in the form.

    • When an error occurs:

      • status: "failed"

Note: The AI-generated content can sometimes contain factual inaccuracies, so always review before relying on the provided details.

3. Reading the Webhook Data in Python

To read and process the webhook data in Python, you can set up a simple server using a framework like Flask:


from flask import Flask, request

app = Flask(__name__)

@app.route('/webhook_endpoint', methods=['POST'])
def handle_webhook():
    data = request.json
    # Process the data as needed
    print(data['root']['ai_summary']['subject'])  # Example: Print the call subject
    return "Webhook received", 200

if __name__ == '__main__':
    app.run(port=5000)

In this example, whenever Answering AI sends a webhook to http://your_server_address/webhook_endpoint, the server will print the subject of the call.

By following this guide, you can effectively set up and interpret post-call webhooks from Answering AI, harnessing real-time insights from your calls.

4. Capturing the Webhook Using Webhooks by Zapier

Zapier offers a straightforward way to receive and act upon webhooks without writing any code. Here's a step-by-step guide to capture the post-call webhook from Answering AI using "Webhooks by Zapier":

  1. Create a New Zap: Log into your Zapier account and click on 'Make a Zap'.

  2. Choose App & Event:

    • In the "Choose App & Event" section, search for "Webhooks by Zapier".

    • Select the "Catch Hook" trigger event and click "Continue".

  3. Set up Trigger:

    • Zapier will provide you with a custom webhook URL. Copy this URL.

    • Go back to your Answering AI dashboard and paste this URL into the webhook URL configuration where you previously set up the post-call webhook.

    • Once you've added the webhook URL to Answering AI, make a test call or simulate one to send a post-call webhook to Zapier.

  4. Test Trigger:

    • Return to Zapier and click "Test trigger". Zapier will listen for the incoming webhook.

    • Once the test data is received, you'll see the call details in Zapier. Click "Continue".

  5. Set up an Action:

    • Now that Zapier has captured the webhook, you can choose an action. This could be anything from adding the call details to a Google Sheet, sending an email summary, creating a task in a project management tool, etc.

    • Search for the desired application in Zapier, choose the specific action event, and set it up as required.

  6. Activate the Zap: Once everything is set up and tested, don't forget to turn on your Zap. Now, every time Answering AI sends a post-call webhook, Zapier will capture it and perform the specified action automatically.

By following this guide, you can effectively set up and interpret post-call webhooks from Answering AI, harnessing real-time insights from your calls.