Using the SDK
Getting started with our SDK
Basic example
import { Project } from 'agentlabs-sdk';
const project = new Project({
projectId: 'you-project-id',
secret: 'your-secret',
url: 'provided-in-your-console'
});
const agent = project.agent('agent-id');
project.onChatMessage((message) => {
if (message.text === 'ping') {
agent.send({
conversationId: message.conversationId,
text: 'pong'
})
} else {
agent.send({
conversationId: message.conversationId,
text: 'I do not understand'
})
}
});
project.connect()Last updated