Skip to main content
Pearl Generic channel cover
Pearl Generic channel cover

Generic Channel

The Generic channel connects your own messaging system to a Pearl Text agent. Use it with a web chat, mobile app, CRM inbox, or any custom platform instead of one of NLPearl’s built-in integrations. The integration uses two webhooks:
The exchange is asynchronous. When you send a user message, NLPearl immediately returns 202 Accepted. Pearl’s reply is delivered shortly afterward as a separate POST request to your outbound URL.

Set Up the Channel

1

Open Text Channels

On the platform, go to Settings, open Text Channels, then find Generic and click Connect Generic.
Generic option highlighted on the Text Channels settings page
2

Configure your endpoint

Enter the details NLPearl will use to send events to your system:
Connect Generic Channel dialog with channel name, outbound URL, and optional auth header fields
3

Save your channel credentials

Click Connect Channel. Open the connected channel to access the credentials required by your integration:
Generic Channel details dialog showing the Channel ID and Signing Secret
Treat the signing secret like a password. Never expose it in client-side code or commit it to source control.
4

Assign the channel to a Pearl

Open the Pearl that should handle these conversations. From its Overview page, open Settings, select Text Channel, and choose the Generic channel you created.
Text Channel field highlighted in the Pearl Overview settings
Your inbound base URL is:

Send Requests to NLPearl

Send every request as JSON and include the channel secret:

Send a User Message

Send a user message to:
chatId is the conversation key. Every message with the same chatId belongs to the same conversation, and every outbound event for that conversation includes it.
Possible responses:

Return Control to Pearl

After a human handoff, return the conversation to Pearl:

End a Conversation

Close a conversation:
Both control actions return 200 when successful or 404 when no active conversation exists for the supplied chatId.

Receive Events from NLPearl

NLPearl sends each event to your outbound URL as a POST request with this envelope:

Event Types

New event types may be added over time. Ignore types your integration does not recognize.

Acknowledge Message Delivery

Your HTTP response controls delivery retries for message events: Other event types, including typing and handoff, are best-effort notifications and are not retried.

Verify Webhook Signatures

NLPearl includes these headers in every request to your outbound URL:
The signature is the hexadecimal result of:
Verify the signature and reject old timestamps to protect your endpoint against forged requests and replay attacks:
Compute the HMAC over the raw request body bytes before parsing the JSON. Re-serializing a parsed body can change its bytes and invalidate the signature.
If you configured a custom authentication header, NLPearl includes it alongside the signature headers.

Handle Human Handoffs

1

Receive the handoff

Pearl sends a handoff event with the reason it stepped aside.
2

Continue forwarding user messages

Let your human agent communicate with the user in your own system. Continue sending the user’s messages to /Message; Pearl remains silent while handed off, but the transcript and inactivity timers stay up to date.
3

Finish the handoff

Call /HandoffToPearl when Pearl should resume, or /EndConversation when the conversation is complete. Your endpoint then receives ai_resumed or conversation_ended, respectively.

Rotate the Secret

Open the connected Generic channel and click the rotate icon beside the Signing Secret to generate a new one.
Rotate Signing Secret button in the Generic Channel details dialog
The previous secret becomes invalid immediately. Update the secret used for both the X-Pearl-Secret request header and webhook signature verification at the same time. Otherwise, your inbound requests and outbound webhook verification will fail until both sides use the new value.

Limits

The channel must be assigned to a running Pearl. If the Pearl is stopped or no Pearl is connected, inbound calls return 400 with "This channel is not connected to a Pearl.".

Inbound

Configure how your Pearl handles incoming conversations, inactivity, transcripts, and webhooks.