Integrations and Extensions
Learn how to connect SparkChat with third-party services, enable webhooks, and extend functionality through voice input and external tools.
{
"event": "message.created",
"chatId": "chat_12345",
"message": "Hello from SparkChat!",
"timestamp": "2024-10-15T10:30:00Z"
}
{
"error": "Invalid signature",
"code": 400
}
const query = 'SELECT Id, Name FROM Account LIMIT 10';
const response = await fetch('https://api.example.com/salesforce/query', {
method: 'POST',
headers: { 'Authorization': `Bearer ${salesforceToken}` },
body: JSON.stringify({ query })
});
Overview
SparkChat supports seamless integrations with external services, allowing you to extend its AI capabilities beyond the core platform. Connect to third-party APIs for custom data sources, set up webhooks for real-time event notifications, enable voice input and text-to-speech (TTS) for hands-free interactions, and integrate with enterprise systems for scalable deployments.
Use these features to build workflows that pull data from CRMs, databases, or collaboration tools, and push SparkChat outputs to your preferred destinations.
API Connections
Fetch data from external services directly in your chats.
Webhooks
Receive instant notifications on events like new messages.
Voice & TTS
Enable audio conversations with AI agents.
Enterprise
Custom integrations for large-scale use.
Connecting to External APIs
Connect SparkChat to any REST API by using the built-in API tool in workflows or agents. Provide the endpoint URL, headers, and parameters to fetch or send data dynamically.
Store sensitive credentials like {API_KEY} in SparkChat's secure environment variables.
Here is an example using the CodeGroup component for multi-language HTTP requests:
const response = await fetch('https://api.example.com/users', {
method: 'GET',
headers: {
'Authorization': `Bearer ${process.env.API_KEY}`,
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import os
headers = {
'Authorization': f'Bearer {os.getenv("API_KEY")}',
'Content-Type': 'application/json'
}
response = requests.get('https://api.example.com/users', headers=headers)
data = response.json()
print(data)
curl -X GET 'https://api.example.com/users' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json'
The unique identifier for the user to fetch.
Bearer token for authentication.
Setting Up Webhooks
Webhooks enable SparkChat to send real-time payloads to your server on events like message completions or agent responses.
Create Webhook Endpoint
Set up a public HTTPS endpoint on your server to receive POST requests.
Configure in SparkChat
Navigate to Workflows > Integrations, add your webhook URL: https://your-webhook-url.com/sparkchat.
Select Events
Choose events like message.created or agent.response.
Test and Verify
Trigger a test event and verify the payload.
Example webhook payload:
Voice and TTS Features
Enable voice input for natural conversations and TTS for AI responses. Supports multiple platforms.
Use the MediaRecorder API for input and Web Speech API for TTS.
// Record and send audio
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
const mediaRecorder = new MediaRecorder(stream);
mediaRecorder.ondataavailable = (event) => {
// Send blob to SparkChat API
const formData = new FormData();
formData.append('audio', event.data);
fetch('https://api.example.com/voice/transcribe', {
method: 'POST',
body: formData
});
};
Integrate with device-native speech recognition.
// Using React Native Voice
import Voice from '@react-native-voice/voice';
Voice.start('en-US');
Voice.onSpeechResults = (e) => {
// Send text to SparkChat
console.log(e.value[0]);
};
Enterprise Integrations
For custom deployments, integrate SparkChat with systems like Salesforce, Slack, or on-premise databases.
Slack Notifications
Send agent responses to Slack channels.
Database Sync
Pull customer data into knowledge bases.
Always validate incoming webhooks with HMAC signatures to prevent unauthorized access.
Last updated today
Built with Documentation.AI