Overview

n8n is a powerful workflow automation tool that can receive and process Beyond Presence webhooks. This guide shows you how to set up n8n to handle webhook events and automate your workflows.

Prerequisites

  • n8n instance (cloud or self-hosted)
  • Beyond Presence account

Step 1: Create Webhook Node

  1. Add Webhook Node: In your n8n workflow, add a “Webhook” node
  2. Configure Settings:
    • Set HTTP Method to POST
    • Set Path to a unique identifier (e.g., /beyond-presence-webhook)
    • Leave Authentication as None (Beyond Presence doesn’t send auth headers yet)
  3. Copy Webhook URL: Copy the generated webhook URL from the node

Your webhook URL will look like: https://your-n8n-instance.com/webhook/beyond-presence-webhook

Step 2: Configure Beyond Presence

  1. Go to the Beyond Presence dashboard
  2. Navigate to webhook settings
  3. Paste your n8n webhook URL and save the configuration

The system will automatically test your endpoint with a test payload.

Step 3: Handle Different Event Types

Add a Switch node after your webhook to handle different event types:

Switch Node Configuration

Use the following value to switch on:

$json.event_type

Create branches for each event type:

  • message - Real-time message events
  • call_ended - Call completion events

Step 4: Process Message Events

For real-time message processing, add nodes after the “message” branch:

Extract Message Data

Use a Set node to extract relevant data:

// Message data extraction
{
  "callId": "{{ $json.call_id }}",
  "sender": "{{ $json.message.sender }}",
  "message": "{{ $json.message.message }}",
  "sentAt": "{{ $json.message.sent_at }}",
  "userName": "{{ $json.call_data?.userName }}",
  "agentId": "{{ $json.call_data?.agentId }}"
}

Example: Send Slack Notification

Add a Slack node to send real-time notifications:

// Slack message template
📞 New message from {{ $json.userName }}

**Message**: {{ $json.message }}
**Call ID**: {{ $json.callId }}
**Time**: {{ $json.sentAt }}

Step 5: Process Call Ended Events

For call completion processing, add nodes after the “call_ended” branch:

Extract Call Summary

Use a Set node to extract call data:

// Call summary extraction
{
  "callId": "{{ $json.call_id }}",
  "userName": "{{ $json.user_name }}",
  "topic": "{{ $json.evaluation.topic }}",
  "sentiment": "{{ $json.evaluation.user_sentiment }}",
  "duration": "{{ $json.evaluation.duration_minutes }}",
  "messageCount": "{{ $json.evaluation.messages_count }}",
  "messages": "{{ $json.messages }}"
}

Example: Save to Database

Add a database node (PostgreSQL, MySQL, etc.) to store call data:

INSERT INTO calls (
  call_id, 
  user_name, 
  topic, 
  sentiment, 
  duration_minutes, 
  message_count,
  created_at
) VALUES (
  '{{ $json.callId }}',
  '{{ $json.userName }}',
  '{{ $json.topic }}',
  '{{ $json.sentiment }}',
  {{ $json.duration }},
  {{ $json.messageCount }},
  NOW()
);

Templates

Here is a list of templates to quickly get started with n8n and Beyond Presence:

Advanced Tips

1. Conditional Processing

Use IF nodes for conditional logic.

For example, to only process messages from users (and not agents), define a condition that checks whether

{{ $json.message.sender }}

is equal to the string user.

2. Data Transformation

Use Code nodes for complex data processing:

// Extract and format message history
const messages = $json.messages || [];
const formattedMessages = messages.map(msg => ({
  sender: msg.sender,
  content: msg.message,
  timestamp: new Date(msg.sent_at).toLocaleString()
}));

return { formattedMessages };

Testing Your Workflow

  1. Test with n8n: Use the “Test Workflow” button to trigger with sample data
  2. Live Testing: Save your webhook URL in Beyond Presence and make a test call with one of your agents
  3. Monitor Executions: Check the execution log in n8n for any errors

Troubleshooting

Resources

Pro Tip: Start with a simple workflow that just logs webhook data, then gradually add more complex processing as you understand the data structure and your requirements.