What you will learn
- Understand the architectural difference between Webhooks and the API.
- Configure the Webhook Skill and choose the correct trigger type.
- Authenticate against the raia API using an Agent Secret Key.
- Call core API endpoints to start conversations and send messages programmatically.
Webhook vs API: Two Directions of Data Flow
When integrating raia with your backend systems, you have two primary tools at your disposal: Webhooks and the API. The difference comes down to which system is initiating the data transfer.

01
Webhooks (Push)
raia automatically pushes data out to your system when an event occurs. You do not need to poll for updates; raia tells you when something happens.
02
API (Pull / Send)
Your system calls raia endpoints to pull data in or send commands on demand. You have full programmatic control over when the interaction happens.
Best Practice: The most robust integrations combine both. Your backend uses the API to start a conversation and pass user context, then uses a Webhook to automatically receive the final transcript when the conversation ends.
Configuring the Webhook Skill
The Webhook Skill allows your agent to send rich JSON payloads containing conversation data to any external URL (like Zapier, Make, n8n, or your own backend endpoint). The most important decision when configuring the skill is choosing the trigger type.

onMessageEndFires after every single reply the agent sends. Ideal for real-time syncing, live lead alerts, or instant CRM updates.
onThreadEndFires only when a conversation goes quiet (typically after 6 minutes of inactivity). Ideal for logging full transcripts, summary reports, or delayed downstream workflows.
The default payload includes the Agent name, User details (if passed via SDK or API), the message content, the Thread ID, and the channel source.
The raia API: Authentication and Core Endpoints
If you need to build a custom interface, trigger agent actions from your own application, or manage agents programmatically, use the raia API.

Authentication
API access is not enabled by default. To use the API:
- In raia CX, open Agents → your agent → Skills. If API is not listed yet, use Add skill and select + on the API card, then select Edit (pencil).
- Select Create API Key, enter a Name and Expiration date, then select Create key. The full key is shown once — copy it into a private store before Done; afterwards the list shows only a masked preview.
- For agent-authenticated operations, pass this key in the request header as
Agent-Secret-Key: YOUR_KEY. Organization operations use Organization-Secret-Key instead — check each operation in the published spec.
Worked example
The examples use fictional data. Follow the same checks with approved, non-sensitive information for your own task.
If API is not on the agent yet, open Add skill and select + on the API card.
- Highlight 1: + (add API)
Once added, select Edit (pencil) on the API card. Adding the skill does not create a key.
- Highlight 1: Edit (pencil)
Worked example
The examples use fictional data. Follow the same checks with approved, non-sensitive information for your own task.
With no keys yet, the list is empty. Select Create API Key.
- Highlight 1: Create API Key
- Highlight 2: No API keys yet
Enter a Name that identifies where the key will be used and choose an Expiration date, then Create key. Choose a lifetime that fits your team’s policy and plan how to replace the key before it expires.
- Highlight 1: Name
- Highlight 2: Expiration date
- Highlight 3: Create key
The full key is shown once with Save your key now - it will never be shown again. Copy it into a private password manager or secret store before you select Done. Never share the key in chat, documentation or screenshots.
- Highlight 1: Save your key now - it will never be shown again.
After Done, the list shows only a masked Key preview with Status, Expires and Created. It cannot reveal the full key again; if you lost it, create a new key and revoke the old one.
- Highlight 1: Key preview (masked)
- Highlight 2: Active
- Highlight 3: Revoke
To stop using a key, select Revoke and reopen the list to check Revoked. Update the application’s stored credential if it needs a replacement, and check that a request using the old key is refused. See the API documentation (https://api.raia2.com/api/external/docs) for the request and authentication header.
- Highlight 1: Revoked key status
- Highlight 2: Delete (only remaining action)
Security Note: This key is a Bearer Token providing full programmatic access to the agent. Store it securely on your server and never expose it in client-side code (like the JS SDK).
Core Endpoints
/external/conversationsCreate a new conversation (requires conversationUserId; optional title and context).
/external/conversations/{id}/messagesSend a user message (required message field; optional context and files) to an existing conversation.
/external/conversations/{id}Retrieve conversation details and feedback. To read its saved messages, use GET /external/conversations/{id}/messages instead.
/external/conversations/{id}/messagesRetrieve the conversation’s saved messages for review.
Frequently Asked Questions
What happens if my webhook endpoint is down when raia tries to send data?
Webhook success and failure are tracked in the thread metadata. Admins can view these logs in Mission Control. Failed attempts may require manual review depending on your retry configuration.
Can I customize the JSON payload sent by the webhook?
The base payload structure is fixed to ensure consistency, but you can filter or transform the data downstream using an integration platform like n8n or Zapier before it reaches its final destination.
Are API rate limits applied per agent or per organization?
Rate limits and usage quotas are generally applied at the organization level, though keys can be scoped per agent to enforce least-privilege access.