// HaiChat SDK for JavaScript
const HaiChat = require('haichat-sdk');
const client = new HaiChat.Client({
apiKey: 'your-api-key',
environment: 'sandbox'
});
// チャットボットとの会話
async function chatWithBot(message) {
try {
const response = await client.chat.send({
message: message,
userId: 'user123'
});
console.log(response.reply);
} catch (error) {
console.error('Error:', error.message);
}
}
chatWithBot('こんにちは!');
# HaiChat SDK for Python
from haichat import HaiChatClient
client = HaiChatClient(
api_key='your-api-key',
environment='sandbox'
)
# チャットボットとの会話
def chat_with_bot(message):
try:
response = client.chat.send(
message=message,
user_id='user123'
)
print(response.reply)
except Exception as e:
print(f'Error: {e}')
chat_with_bot('こんにちは!')