This Node.js application implements a WebSocket Express server that follows the Genesys AudioHook protocol to receive call audio, format it to wav
, and upload it to S3.
- Full implementation of the Genesys AudioHook WebSocket protocol
- Records incoming audio data from Genesys calls
- Handles all protocol events (open, close, pause, ping, etc.)
- Uploads recordings to Amazon S3 upon call completion
- API key authentication for security
- Node.js 14.x or higher
- AWS account with S3 bucket access
- Genesys Cloud account with AudioHook integration
- Clone this repository
- Install dependencies:
npm install
- Configure environment variables (see Configuration section)
Add these to your package.json:
{
"dependencies": {
"@aws-sdk/client-s3": "^3.360.0",
"dotenv": "^16.5.0",
"express": "^4.18.2",
"ws": "^8.13.0"
}
}
The application can be configured using environment variables:
Variable | Description | Default |
---|---|---|
PORT | Server port | 3000 |
RECORDINGS_DIR | Directory to store temporary recordings | ./recordings |
AWS_REGION | AWS region for S3 | us-east-1 |
S3_BUCKET | S3 bucket name | audiohook-recordings |
S3_KEY_PREFIX | Prefix for S3 object keys | calls/ |
API_KEY | API key for authentication | your-api-key-here |
Set environment variables in .env
file:
PORT=3000
API_KEY=your-api-key-here
AWS_REGION=us-east-1
S3_BUCKET=your-bucket-name
S3_KEY_PREFIX=calls/
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
RECORDINGS_DIR=./recordings
# Start the server
npm start
- In Genesys Cloud, create a new AudioHook integration
- Set the WebSocket URI to the deployed application URL (e.g.,
wss://your-domain.com
) - Configure the API key to match the
API_KEY
variable in yourenv
- Associate the AudioHook integration with your call flows
- Check the server logs for detailed information about connection issues
- Verify that your API key matches between Genesys Cloud and your application
- Ensure your AWS credentials have proper permissions for the S3 bucket
- The
/health
endpoint can be used to check if the server is running