ChatSonic AI Bot for Businesses
ChatSonic AI Bot for Businesses
What is ChatSonic AI Bot for Businesses ?
ChatSonic AI Bot for Businesses is a custom chatbot designed to communicate with users through natural language conversations. It uses artificial intelligence (AI) and machine learning algorithms to understand and respond to user queries, perform tasks, and provide information.
For corporates, chatbots can be a powerful tool for providing customer support, improving engagement with users, and automating routine tasks. With a custom chatbot, a company can create a personalized and branded experience for their users, tailor the chatbot's responses to specific use cases, and integrate it with their existing systems and processes.
How to use ChatSonic AI Bot for Businesses?
- Go to Writesonic.com and signup if you don't have an account already.
- Use click select ChatSonic AI Bot for Businesses Feature.
- you'll have this interface ->

- Fill in the customization details
- For the welcome message, you can pass {user_name} as a variable that the ChatSonic AI bot for businesses can pick up dynamically when embedded in your app.
- Once you've filled in the basic details press save.
- Move to the Information Tab, it would look like this
- Upload a file/URL for the bot to read and remember while answering your queries, it can take from a couple of seconds to minutes.
- Once the file is processed you can test the bot with the widget on right end.
Integrating the ChatSonic AI Bot for Businesses.
To integrate the ChatSonic AI Bot for Businesses into your app/website you can either use the embed code (coming soon) or you can use the custom API endpoint built entirely for your bot using the request below.
fetch('https://api.writesonic.com/v1/botsonic/botsonic/generate/your-bot-id', {
method: 'POST',
headers: {
'Accept-Encoding': 'gzip, deflate',
'Connection': 'keep-alive',
'Content-Length': '64',
'Content-Type': 'application/json',
'User-Agent': 'python-requests/2.28.1',
'accept': 'application/json',
'token': '<Your botsonic token>'
},
// body: '{"question": "How to develop these skills?", "chat_history": []}',
body: JSON.stringify({
'question': 'How to develop these skills?',
'chat_history': []
})
});
import requests
headers = {
# 'Accept-Encoding': 'gzip, deflate',
'Connection': 'keep-alive',
# 'Content-Length': '64',
# Already added when you pass json=
# 'Content-Type': 'application/json',
'User-Agent': 'python-requests/2.28.1',
'accept': 'application/json',
'token': '<Your botsonic token>',
}
json_data = {
'question': 'How to develop these skills?',
'chat_history': [],
}
response = requests.post('https://api.writesonic.com/v1/botsonic/botsonic/generate/your-bot-id', headers=headers, json=json_data)
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{"question": "How to develop these skills?", "chat_history": []}`)
req, err := http.NewRequest("POST", "https://api.writesonic.com/v1/botsonic/botsonic/generate/your-bot-id", data)
if err != nil {
log.Fatal(err)
}
// req.Header.Set("Accept-Encoding", "gzip, deflate")
req.Header.Set("Connection", "keep-alive")
req.Header.Set("Content-Length", "64")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("User-Agent", "python-requests/2.28.1")
req.Header.Set("accept", "application/json")
req.Header.Set("token", "<Your botsonic token>")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
import 'package:http/http.dart' as http;
void main() async {
var headers = {
'Accept-Encoding': 'gzip, deflate',
'Connection': 'keep-alive',
'Content-Length': '64',
'Content-Type': 'application/json',
'User-Agent': 'python-requests/2.28.1',
'accept': 'application/json',
'token': '<Your botsonic token>',
};
var data = '{"question": "How to develop these skills?", "chat_history": []}';
var url = Uri.parse('https://api.writesonic.com/v1/botsonic/botsonic/generate/your-bot-id');
var res = await http.post(url, headers: headers, body: data);
if (res.statusCode != 200) throw Exception('http.post error: statusCode= ${res.statusCode}');
print(res.body);
}
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.writesonic.com/v1/botsonic/botsonic/generate/your-bot-id");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Accept-Encoding", "gzip, deflate");
httpConn.setRequestProperty("Connection", "keep-alive");
httpConn.setRequestProperty("Content-Length", "64");
httpConn.setRequestProperty("Content-Type", "application/json");
httpConn.setRequestProperty("User-Agent", "python-requests/2.28.1");
httpConn.setRequestProperty("accept", "application/json");
httpConn.setRequestProperty("token", "<Your botsonic token>");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("{\"question\": \"How to develop these skills?\", \"chat_history\": []}");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
if ("gzip".equals(httpConn.getContentEncoding())) {
responseStream = new GZIPInputStream(responseStream);
}
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
curl -X POST -H 'Accept-Encoding: gzip, deflate' -H 'Connection: keep-alive' -H 'Content-Length: 64' -H 'Content-Type: application/json' -H 'User-Agent: python-requests/2.28.1' -H 'accept: application/json' -H 'token: <Your botsonic token>' -d '{"question": "How to develop these skills?", "chat_history": []}' https://api.writesonic.com/v1/botsonic/botsonic/generate/your-bot-id
const axios = require('axios');
const response = await axios.post(
'https://api.writesonic.com/v1/botsonic/botsonic/generate/your-bot-id',
// '{"question": "How to develop these skills?", "chat_history": []}',
{
'question': 'How to develop these skills?',
'chat_history': []
},
{
headers: {
'Accept-Encoding': 'gzip, deflate',
'Connection': 'keep-alive',
'Content-Length': '64',
'Content-Type': 'application/json',
'User-Agent': 'python-requests/2.28.1',
'accept': 'application/json',
'token': '<Your botsonic token>'
}
}
);
The output would look something like this
[{
"data": {
"answer": "Winning is an attitude. It is about having the courage and resilience to face challenges, the perseverance to keep going, and the motivation to make it happen. To win, you must believe in yourself and be willing to take risks. You must also be prepared to learn from your mistakes and use them to become better. Finally, you must be willing to put in the hard work to make your goals a reality.",
"source": "https://botsonic.s3.amazonaws.com/1439a338-ed84-406a-aa1d-103f27693fd8.pdf",
"chat_history": ["Human: How to win\nPDFbot: \nWinning is an attitude. It is about having the courage and resilience to face challenges, the perseverance to keep going, and the motivation to make it happen. To win, you must believe in yourself and be willing to take risks. You must also be prepared to learn from your mistakes and use them to become better. Finally, you must be willing to put in the hard work to make your goals a reality."]
}
}]
and to retain memory we pass back the chat_history in the next request.
Embeddable Widget
ChatSonic is an embeddable widget that allows you to integrate a custom AI bot into your website. To get started, simply follow these steps:
Step 1: Copy the Snippet
<script>
(function (w, d, s, o, f, js, fjs) {
w["chatsonic_widget"] = o;
w[o] =
w[o] ||
function () {
(w[o].q = w[o].q || []).push(arguments);
};
(js = d.createElement(s)), (fjs = d.getElementsByTagName(s)[0]);
js.id = o;
js.src = f;
js.async = 1;
fjs.parentNode.insertBefore(js, fjs);
})(window, document, "script", "ws", "https://writesonic.s3.amazonaws.com/frontend-assets/CDN/chatsonic.js");
ws("init", {
botId: "",
username: "",
customTitle: "",
customIcon: "",
chatBotColor: "#C37625",
chatBotAvatarURL: "",
welcomeMessage:" ",
serviceBaseUrl: "https://api.writesonic.com",
token: "",
});
</script>
Step 2: Paste the Snippet
Paste the copied code snippet in your HTML code where you want to display the ChatSonic chatbot.
Step 3: Customize Your ChatBot
Now you can customize your ChatBot according to your needs by changing the values of the properties in the code snippet. Here are some of the properties that you can customize:
botId: This is the ID of your ChatBot.
username: This is the name of your ChatBot.
customTitle: This is the title of your ChatBot.
customIcon: This is the icon of your ChatBot.
chatBotColor: This is the color of your ChatBot.
chatBotAvatarURL: This is the avatar of your ChatBot.
welcomeMessage: This is the welcome message that will appear when the ChatBot is first opened.
serviceBaseUrl: This is the base URL of the ChatBot service.
token: This is the token for your ChatBot.
Step 4: Save Your Changes
Make sure to save your changes and your ChatSonic chatbot will be up and running!
That's it! You have successfully integrated ChatSonic into your website. Enjoy the benefits of having a custom AI bot that can interact with your visitors and customers.
Updated 2 days ago