Add Prompt ai.prompt.register
We are still updating this page
Some data may be missing — we will fill it in shortly.
Scope:
ai_adminWho can execute the method: administrator
The method ai.prompt.register adds a prompt.
|
Parameter |
Description |
|
category |
The category of the embedding location. CoPilot can be located in various parts of the product. The list of categories is provided below |
|
code |
A unique code for the prompt. The code must use the prefix The pre-prompt can only be updated through its deletion |
|
icon |
Icon code. You can find a suitable icon in the file copilot_icons.pdf |
|
prompt |
The text of the prompt. This is what will be sent to the neural network (the user will not see it). The pre-prompt text can use special formatting: markers and conditions |
|
translate |
An array of translations for the item in different languages. Ideally, support at least two languages: English (en) and the portal's language. Support for other languages is at your discretion |
|
parent_code |
The code of the parent section. The code must use the prefix |
|
sort |
Sorting, specified optionally. Responsible for sorting items among themselves |
|
section |
The category in the prompt menu for visual separation. It can have the following values:
If nothing is specified, the prompt will be placed above these categories |
Category
|
Embedding location category |
Where it will appear in CoPilot |
|
livefeed |
News feed post |
|
livefeed_comments |
Comment on one of the news feed posts |
|
tasks |
Task description |
|
tasks_comments |
Comment on one of the tasks |
|
chat |
Message in one-on-one or group chats |
|
|
Emails from the personal inbox |
|
mail_crm |
Emails with CRM clients in the deal, contact, or company cards |
|
landing |
Texts in the Bitrix24 site builder |
Examples
// example for cURL (Webhook)
// example for cURL (OAuth)
try
{
const response = await $b24.callMethod(
'ai.prompt.register',
{
category: [
"livefeed",
"livefeed_comments"
],
code: 'rest_joke',
icon: 'smile',
prompt: 'Tell a joke',
translate: {
"en":"A joke",
"de":"Ein Witz"
}
}
);
const result = response.getData().result;
console.info(result);
}
catch( error )
{
console.error(error);
}
try {
$response = $b24Service
->core
->call(
'ai.prompt.register',
[
'category' => [
"livefeed",
"livefeed_comments"
],
'code' => 'rest_joke',
'icon' => 'smile',
'prompt' => 'Tell a joke',
'translate' => [
"en" => "A joke",
"de" => "Ein Witz"
]
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error registering AI prompt: ' . $e->getMessage();
}
BX24.callMethod(
'ai.prompt.register',
{
category: [
"livefeed",
"livefeed_comments"
],
code: 'rest_joke',
icon: 'smile',
prompt: 'Tell a joke',
translate: {
"en":"A joke",
"de":"Ein Witz"
}
},
function(result)
{
if(result.error())
{
console.error(result.error());
}
else
{
console.info(result.data());
}
}
);
// example for php
How to Use Examples in Documentation