Webhook Types
RevRing supports two types of webhooks:- Pre-Call Webhooks: Called before an inbound call is answered, allowing you to personalize the agent’s behavior
- Post-Call Webhooks: Called after any call ends, providing complete call details including transcript and recording
Pre-Call Webhooks
Pre-call webhooks enable dynamic customization of agent behavior based on caller information. Before answering an inbound call, RevRing sends caller details to your webhook and uses the response to personalize the conversation.When to Use
- Look up caller information in your CRM
- Customize greetings based on customer status or history
- Route calls differently based on caller context
- Apply business hours logic or special handling
- Personalize the agent’s knowledge with customer-specific data
Configuration
- Navigate to your agent’s Advanced tab
- Set the Pre-call Webhook URL:
- Click Save
Pre-call webhooks only apply to inbound calls. Outbound calls receive variables directly via the API when the call is sent.
Request Format
When an inbound call arrives, RevRing sends a POST request to your webhook:event: Always"pre_call"for pre-call webhooksagentId: The agent that will handle the callfromNumber: Caller’s phone number (E.164 format)toNumber: The number that was dialed
Response Format
Your webhook must respond within 3 seconds with a JSON object containing variables:{{variable_name}} syntax.
Variables you return can override system variables like
{{current_time}} and {{timezone}} if needed. However, system variables ({{direction}}, {{user_number}}, {{agent_number}}, {{current_time}}, {{timezone}}, {{language}}) are automatically provided and don’t need to be set via webhook.Using Variables in Agent Configuration
Reference webhook variables in your First Message:Error Handling
If your webhook fails, times out, or returns invalid JSON:- RevRing will proceed with the call using default variables (if configured)
- The call will not be rejected - the agent will answer without personalization
- Check the call’s
preCallWebhookStatusfield to see webhook delivery status
success: Webhook responded successfullyfailed: Webhook returned an error (4xx/5xx status)timeout: Webhook didn’t respond within 3 secondsnull: No webhook configured
Example Implementation
Node.js / Express:Post-Call Webhooks
Post-call webhooks deliver complete call details immediately after a call ends, including the transcript, recording URL, summary, and metadata.When to Use
- Update your CRM with call outcomes
- Log call details for compliance or auditing
- Trigger follow-up workflows (emails, tasks, tickets)
- Track agent performance metrics
- Store transcripts and recordings in your system
- Implement custom analytics or reporting
Configuration
- Navigate to your agent’s Overview tab
- Set the Post-call Webhook URL:
- Click Save
Post-call webhooks fire for both inbound and outbound calls.
Request Format
After a call ends, RevRing sends a POST request with complete call details:id: Unique call identifierstatus: Final call status (COMPLETED,FAILED,CANCELED, etc.)durationSeconds: Total call duration (null if never answered)recordingUrl: URL to download the call recordingtranscript: Complete conversation with timestamps and tool invocations (both custom tools and system tools likeend_call,transfer_to_number)summary: AI-generated summary of the callmetrics: Token usage and audio duration metricshangupCause: Reason call ended. Common values includeUSER_ENDED,END_CALL_TOOL,SILENCE_TIMEOUT,MAX_DURATION,VOICEMAIL_DETECTED
The example above shows both a custom tool (
check_order_status) and a system tool (end_call). When a call is transferred using transfer_to_number, the transcript will contain a similar tool entry with name: "transfer_to_number" and args containing to_number.For complete field descriptions and additional examples, see the Post-Call Webhook API Reference.
Response Expectations
Your webhook should:- Respond with
200 OKstatus code - Respond within 5 seconds
- Handle the webhook asynchronously if processing takes time
Error Handling
If your webhook fails (4xx/5xx status) or times out:- The webhook is marked as
failedin the call record - RevRing does not automatically retry failed webhooks
- You can check
postCallWebhookStatusin the call object to see delivery status - Implement your own retry logic by querying failed calls via the API if needed
success: Delivered successfullyfailed: Webhook returned an error or timed outnull: No webhook configured
Example Implementation
Node.js / Express:Security Best Practices
Verify Webhook Sources
HMAC Signature Verification: Contact RevRing support to set up HMAC signature verification for your webhooks. This ensures requests are authentic and coming from RevRing. Request Validation: Implement validation to ensure webhook requests contain expected fields and structure.Use HTTPS
Always use HTTPS for webhook URLs to ensure data is encrypted in transit:Validate Payload
Validate incoming webhook data before processing:Rate Limiting
Implement rate limiting to prevent abuse:Testing Webhooks
Local Development with ngrok
For local testing, use ngrok to expose your local server:Testing Tools
Request Inspection: Use webhook.site to inspect webhook payloads without writing code. Manual Testing: Use curl to simulate webhook responses:Test with Real Calls
- Configure your webhook URL
- Make a test call using the Test Agent tab
- Review your server logs to see the webhook requests
- Check call details in Call Logs to verify webhook status
Monitoring Webhooks
Check Webhook Status
For each call in Call Logs:- Click on the call to view details
- Check Webhook Status in the Overview card:
- Pre-call webhook status
- Post-call webhook status
- If failed, review your server logs for errors
Common Issues
Webhook returns timeout
Webhook returns timeout
- Ensure your webhook responds within 3 seconds (pre-call) or 5 seconds (post-call)
- Move slow operations (database writes, external API calls) to async background processing
- Return acknowledgment immediately, then process in background
- Check your server’s response time and optimize slow queries
Webhook marked as failed
Webhook marked as failed
- Verify your endpoint is accessible from the internet
- Check that you’re returning a 200 status code
- Ensure response is valid JSON (even if empty:
{}) - Review server logs for exceptions or errors
- Test endpoint with curl or Postman to verify it works
Variables not appearing in agent responses
Variables not appearing in agent responses
- Verify your pre-call webhook returns valid JSON with variable keys
- Check variable names match exactly between webhook and prompt (case-sensitive)
- Ensure webhook responds within 3 seconds
- Test webhook independently to confirm it returns expected data
- Review the call’s
variablesfield in call logs to see what was actually received
Not receiving post-call webhooks
Not receiving post-call webhooks
- Confirm the webhook URL is configured in the agent’s Overview tab
- Verify the URL is correct and accessible
- Check your server logs - RevRing may be sending but your server isn’t logging
- Test with webhook.site to confirm RevRing is sending requests
- Review firewall rules that might block incoming requests
Best Practices
Performance
- Respond quickly: Acknowledge webhooks within 1-2 seconds
- Process asynchronously: Handle heavy processing in background jobs
- Cache frequently: Cache CRM lookups or database queries when possible
- Use connection pooling: Reuse database connections across requests
- Set timeouts: Configure timeouts for external API calls to prevent hanging
Reliability
- Idempotency: Design webhooks to handle duplicate calls (use
idas idempotency key) - Error handling: Wrap processing in try/catch and return 200 even if internal processing fails
- Logging: Log all webhook requests and responses for debugging
- Monitoring: Set up alerts for webhook failures or high error rates
- Fallbacks: Provide default values if lookups fail
Security
- HTTPS only: Never use HTTP for webhook URLs
- Validate input: Sanitize and validate all incoming data
- Request validation: Verify requests contain expected structure and fields
- Rate limiting: Protect against potential abuse
- Audit logging: Log all webhook activity for security review