Agents lists and templates
To better manage the various agents available, we have set up templates and agent lists:
- Template: These are the agent pre-configurations that you have or will co-construct with Reecall's CSM team.
- Agent list: Lists are, as the name suggests, a list of different templates grouped together in the same category. ( Note that a template can be present in several lists )
To start with the templates, they are defined as follows:
- name: Template name.
- type: Type of template.
- template: The template part, which will be used to create the new object.
Currently, templates are only available with the agent type.
Now, if you want an exhaustive list of all the agent templates available to you, proceed as follows.
Based on template api documentation.
- cURL
- NodeJS
curl -X GET \
-H "Authorization: Bearer <APIKEY>" \
-H "Content-Type: application/json" \
{{baseUrl}}/api/templates?filter=%7B%22where%22%3A%20%7B%22type%22%3A%20%22agent%22%7D%7D
const axios = require('axios');
const baseUrl = "{{baseUrl}}/api/template?filter=%7B%22where%22%3A%20%7B%22type%22%3A%20%22agent%22%7D%7D";
const apiKey = "YOUR API KEY";
const headers = {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
};
axios.get(baseUrl, { headers: headers })
.then(response => {
console.log('Status Code:', response.status);
console.log('Response Data:', response.data);
})
.catch(error => {
console.error('Error:', error.response.status);
console.error('Error Data:', error.response.data);
});
Fitler part is an url encoded object which look like this:
{
"where": {
"type": "agent"
}
}
Now that we've retrieved the list of available agent templates, let's see how to retrieve the various lists by including templates in them.
- cURL
- NodeJS
curl -X GET \
-H "Authorization: Bearer <APIKEY>" \
-H "Content-Type: application/json" \
{{baseUrl}}/api/templates?filter=%7B%22include%22%3A%20%22templates%22%7D
const axios = require('axios');
const baseUrl = "{{baseUrl}}/api/template?filter=%7B%22include%22%3A%20%22templates%22%7D";
const apiKey = "YOUR API KEY";
const headers = {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
};
axios.get(baseUrl, { headers: headers })
.then(response => {
console.log('Status Code:', response.status);
console.log('Response Data:', response.data);
})
.catch(error => {
console.error('Error:', error.response.status);
console.error('Error Data:', error.response.data);
});
In the example above, filters look like the following object:
{
"include": "templates"
}
If you ever want to reduce the size of your response objects, you can add relationship information and specify the desired fields.
- cURL
- NodeJS
curl -X GET \
-H "Authorization: Bearer <APIKEY>" \
-H "Content-Type: application/json" \
{{baseUrl}}/api/templates?filter=%7B%22include%22%3A%20%5B%7B%22relation%22%3A%20%22templates%22%2C%20%22scope%22%3A%20%7B%22fields%22%3A%20%5B%22id%22%2C%20%22name%22%5D%7D%7D%5D%7D
const axios = require('axios');
const baseUrl = "{{baseUrl}}/api/template?filter=%7B%22include%22%3A%20%5B%7B%22relation%22%3A%20%22templates%22%2C%20%22scope%22%3A%20%7B%22fields%22%3A%20%5B%22id%22%2C%20%22name%22%5D%7D%7D%5D%7D";
const apiKey = "YOUR API KEY";
const headers = {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
};
axios.get(baseUrl, { headers: headers })
.then(response => {
console.log('Status Code:', response.status);
console.log('Response Data:', response.data);
})
.catch(error => {
console.error('Error:', error.response.status);
console.error('Error Data:', error.response.data);
});
In the example above, filters look like the following object:
{
"include": [{
"relation": "templates",
"scope": {
"fields": ["id", "name"]
}
}]
}