Scout9 Customer Relationship Management API đŚ´
Scout9 Node.js API
â ď¸ API is not fully released, caution when using
Customer conversations while your away đđťđ
Auto responses that are 100% you from any native channel such as your phone, email, and more
â
Programmable conversations
đ [Interject and pause auto responses when you type]('#Respond to a customer')
đŤđ¤ Not a bot, 100% you
Scout9 Use Cases
All 100% from your voice and personal email or phone number!
Setup
- Register and grab an API key from Scout9
- (Optional) Purchase a Scout9 email or phone number if you prefer
npm install @scout9/admin --save
import { Configuration, Scout9Api } from '@scout9/admin';
const configuration = new Configuration({
apiKey: '',
});
const scout9 = new Scout9Api(configuration);
Full Example
Step 1: Register yourself as an agent
import fs from 'fs/promises';
import path from 'path';
const agentId = await scout9
.agentRegister({
firstName: 'Tony',
lastName: 'Sopranos',
title: 'Boss',
context: 'I\'m Tony. Look, this life, it ain\'t for the faint-hearted. I got responsibilities - to my family and my crew. Loyalty, respect, that\'s everything. When I deal with my associates, I\'m direct. I expect them to come to me straight, no BS. Some might call me tough, even ruthless, but it\'s the world we\'re in. You show weakness, you\'re done. I\'ve got a code, though. If you\'re loyal to me, I\'ll have your back. But cross me? That\'s something you\'ll regret. It\'s business, but it\'s also personal. We\'re a family.',
forwardPhone: '+15555555544',
forwardEmail: 'tonyboss@gmail.com',
programmablePhoneNumber: '+15555555555',
programmableEmail: `tonyboss@gmail.com`,
conversations: [
await scout9.fileCreate(await fs.readFile('./conversation1.txt'), 'conversation with Chris')
.then(res => res.data.id),
await scout9.fileCreate(await fs.readFile('./conversation2.txt'), 'conversation with Paulie')
.then(res => res.data.id),
],
audio: [
await scout9.fileCreate(await fs.readFile('./audio.mp3'),
'Secret Audio of me talking to Dr. Melfi (no one can know about this)').then(res => res.data.id),
]
})
.then((res) => res.data.id);
Step 2: Register customers
You can register customers by adding their email or phone.
â ď¸ Note: If you are using a provided Scout9 email or phone number, customers must opt-in to receive messages or
initiate conversations with you.
const customerId = await scout9.createCustomer({
firstName: 'Hi',
lastName: 'Jack',
email: 'hi@example.com',
phone: '+15555555555',
})
.then((res) => res.data.id);
const customers: Customer[] = [
{
name: 'Tony Soprano',
phone: null,
email: null,
role: 'boss',
customId: 'tony-soprano',
fun_fact: 'I love my ducks'
},
{
name: 'Carmela Soprano',
phone: null,
email: null,
favorite_drink: 'lillet blanc',
},
{
name: 'Salvatore Bonpensiero',
firstName: 'Salvatore',
phone: null,
email: null,
$agent: 'skip_lipari',
rat: true,
location: 'New Jersey coast',
nickname: 'Big đ',
lastSeason: 'season 1'
}
];
await scout9.customersCreate({customers});
Step 3: Initiate a conversation
Initiate a default generic conversation with an existing customer, use the optional initialMessage to provide some
guidance.
const initialMessage = `Hey there, would you like a free pizza?`;
const conversation = await scout9.conversationCreate({
customer: customerId,
agent: agentId,
environment: 'phone',
initialContexts: [
'We are offering free pizzas to the first 100 hundred customers for today only',
'We have pepperoni, cheese, meat lovers, and vegan pizzas available',
'We do not have gluten free pizzas available at this time',
'We are only offering free pizzas, nothing else',
'You must pick up the free pizza at 255 W Alameda St, Tucson, AZ 85701',
'We close at 10pm tonight',
'If the customer is not interested or serious in receiving a free pizza, disengage and direct them to our website (https://azpizzatime.com) for future orders'
]
});
await scout9.message({convo: conversation.data.id, message: initialMessage});
Step 4: Test your conversation
Test your conversation before you send a message.
const initialMessage = `Hey there, would you like a free pizza?`;
const conversationId = await scout9.conversationCreate({
customer: customerId,
agent: agentId,
environment: 'phone',
initialContexts: [
'We are offering free pizzas to the first 100 hundred customers for today only',
'We have pepperoni, cheese, meat lovers, and vegan pizzas available',
'We do not have gluten free pizzas available at this time',
'We are only offering free pizzas, nothing else',
'You must pick up the free pizza at 255 W Alameda St, Tucson, AZ 85701',
'We close at 10pm tonight',
'If the customer is not interested or serious in receiving a free pizza, disengage and direct them to our website (https://azpizzatime.com) for future orders'
]
}).then((res) => res.data.id);
const anticipatedCustomerResponses = [
'Yes please!',
'No thanks',
'What kind of pizza are we talking about?',
'I\'m vegan, do you have vegan pizza?',
'I hate you, stop texting me',
'I love you, keep texting me',
];
for (const customerResponse of anticipatedCustomerResponses) {
const generatedResponse = await scout9.generate({
convo: conversationId,
mocks: {
messages: [
{
role: 'customer',
content: customerResponse
}
]
}
})
.then((res) => res.data.content);
console.log(`\n\tCustomer: "${customerResponse}"\n\tAgent: "${generatedResponse}"\n`);
}
console.log(`Looks good đ - sending messing to customer`);
await scout9.message({convo: conversation.data.id, message: initialMessage});
Step 5: View your conversation
Messages and customer responses can be viewed in the Scout9 UI. You can also
configure webhooks in the account portal to listen to incoming messages on your own server.
const messages = await scout9.messages(conversationId);
console.log(`Retrieved ${messages.data.length} messages from the conversation`);
for (const message of messages.data) {
console.log(`\t${message.role}: ${message.content}`);
}
Advanced Examples
Schedule a conversation
See simple-schedule-conversation.ts on how to test a conversation before its
created.
const initialMessage = `Hey there, would you like a free pizza?`;
const conversation = await scout9.scheduleConversation({
customer: customerId,
agent: agentId,
environment: 'phone',
initialContexts: [
'We are offering free pizzas to the first 100 hundred customers for today only',
'We have pepperoni, cheese, meat lovers, and vegan pizzas available',
'We do not have gluten free pizzas available at this time',
'We are only offering free pizzas, nothing else',
'You must pick up the free pizza at 255 W Alameda St, Tucson, AZ 85701',
'We close at 10pm tonight',
'If the customer is not interested or serious in receiving a free pizza, disengage and direct them to our website (https://azpizzatime.com) for future orders'
]
});
Define workflows
Conversations by default use a generic workflow procedure that has a stated goal to guide your Scout9 in a
conversation. Initiate a conversation with a clear specific objective using the workflow api.
See full workflow example
const workflow: CreateWorkflowRequest = {
name: 'Order Pizza',
context: 'When a customer wants to order a pizza, I will determine what pizza they need and when, then determine if it needs to be picked up or delivered to their address.',
fields: contextFields,
initiators: {
entities: customEntities,
documents: workflowTriggerStatements
},
};
const workflowId = await scout9.workflowCreate(workflow).then(res => res.data.id);
console.log(`Created workflow with id: ${workflowId}`);
Use the .fields
property to guide the conversation to accomplish the goal. In this example we ask the user for the
pizza size, sauce, toppings, when, delivery or take out, and if delivery then the address.
const contextFields: ConversationContextField[] = [
{
id: 'determineSize',
context: 'Determine what size pizza the customer wants, we have small, medium, and large',
conditions: [
{
conditions: [
{
key: 'pizzaSize',
operator: 'notExists',
value: true
}
]
}
]
},
]
In the .initiators.entities
we can define custom fields that the Scout9 can search for and store in the
conversation
In this example we include a custom entity field pizzaSize
which can be described as a small or personal pizza.
const customEntities = [
{
utteranceId: 'pizzaSize',
option: 'small',
languages: ['en'],
text: [
'small',
'personal',
'individual',
'6-inch',
'8-inch',
]
},
]
Then we need some statements that can trigger the workflow and context fields that get stored in .initiators.documents
.
const workflowTriggerStatements = [
{text: 'I would like to order a %pizzaSize% %pizzaType%', id: 'request'},
];
Respond to a customer
If a customer triggers one of your active workflows, then by default your Scout9 will respond to the customer.
If you respond manually, then the Scout9 will stop responding to the customer for the entire conversation.
await scout9.message({convo: conversationId, message: 'Hey there, would you like a free pizza?'});
Available Platforms
Customers can interact with you (and your Scout9) on any of the connected platforms
Platforms | Supported | |
---|
Android | â ď¸ (pending) | (free) An android app is in development to enable your Scout9 to respond to SMS text |
iOS | â ď¸ (pending) | (free) An ios app is in development to enable your Scout9 to respond to iMessages |
Web | â
| (free) We generate conversation links for you and your customers to quickly connect, conversations expire in 1 day |
Gmail | â
| (free) Provide Scout9 authorization access to your gmail account for read/write capabilities so your Scout9 can respond to emails |
Outlook | â ď¸ (pending) | (free) Provide Scout9 authorization access to your outlook account for read/write capabilities so your Scout9 can respond to emails |
Native Email | â | For security and privacy concerns we currently cannot support native email systems at this time |
Discord | â ď¸ (pending) | (free) Download the Scout9 Discord bot and configure workflows to respond to messages accordingly |
Slack | â ď¸ (pending) | (free) Download the Scout9 Slack agent and configure workflows to respond to messages accordingly |
Teams | â ď¸ (pending) | (free) Download the Scout9 Teams add-on |
Scout9 Phone | â
| $5/month we provide a generated phone number you can use for your Scout9 to text, messages will be relayed back to your personal phone number |
Scout9 Email | â
| $5/month We provide a generated email with your name (e.g. patrick.opie@scout9.com) you can use for your Scout9 |
Instagram | â ď¸ (pending/limited) | (free) The Scout9 desktop or mobile app will auto generate responses but requires manual insertion |
Tiktok | â ď¸ (pending/limited) | (free) The Scout9 desktop or mobile app will auto generate responses but requires manual insertion |
Facebook | â ď¸ (pending/limited) | (free) The Scout9 desktop or mobile app will auto generate responses but requires manual insertion |
â ď¸ Warning: Avoid using a Scout9 to autopilot your job and personal relationships, this tool is designed for
workplace productivity and not a substitute for human interaction.