ReplyPier Widget Test Page

About ReplyPier

This is a test page demonstrating the ReplyPier chat widget integration. The widget provides real-time chat functionality with AI-powered responses and seamless human handoff capabilities.

Widget Controls

Enter your widget ID and click initialize to load the chat widget.

Token Authentication (Optional)

For agents with "Require Token Auth" enabled, provide an API key to authenticate.

Integration Code

To add the ReplyPier widget to your website, add the following code before the closing </body> tag:

Basic (No Authentication)


<script>
    window.replypierId = 'YOUR_WIDGET_ID';
    // Required for local testing — without it the widget uses the API URL baked
    // into the build (the cloud API for a production build).
    window.replypierBaseUrl = 'http://localhost:8000/api/v1';
</script>
<script src="http://localhost:5173/webclient/replypier.min.js"></script>
        

With Token Authentication

For agents with "Require Token Auth" enabled, generate a token server-side:


// Server-side: Generate token using your API key
const response = await fetch('http://localhost:8000/api/v1/generate-token', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
        widget_id: 'YOUR_WIDGET_ID',
        customer_email: 'user@example.com',  // optional
        ttl_seconds: 3600
    })
});
const { data } = await response.json();
// Pass data.token to frontend

// Client-side: Initialize widget with token
<script>
    window.replypierId = 'YOUR_WIDGET_ID';
    window.replypierToken = 'TOKEN_FROM_SERVER';
    window.replypierBaseUrl = 'http://localhost:8000/api/v1';
</script>
<script src="http://localhost:5173/webclient/replypier.min.js"></script>