@ihazz/bitrix24 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/bitrix24/SKILL.md +28 -2
- package/src/channel.ts +6 -1
package/package.json
CHANGED
package/skills/bitrix24/SKILL.md
CHANGED
|
@@ -63,9 +63,35 @@ When you see a message from a Bitrix24 user, you can react to acknowledge it bef
|
|
|
63
63
|
|
|
64
64
|
**Important:** Do NOT invent or guess messageId values. Either omit `messageId` to react to the current message, or use a messageId that was explicitly provided to you.
|
|
65
65
|
|
|
66
|
+
## Inline Buttons
|
|
67
|
+
|
|
68
|
+
You CAN and SHOULD use inline keyboard buttons in Bitrix24. **Never say you cannot create buttons — you can.**
|
|
69
|
+
|
|
70
|
+
Whenever your reply contains a list of options, choices, or suggestions that the user could pick from — **always** format them as inline buttons instead of a numbered or bulleted list. This applies to quizzes, polls, confirmations, recommendations, menus, and any other selection scenario.
|
|
71
|
+
|
|
72
|
+
To add buttons, append a JSON line at the end of your message text using this exact format:
|
|
73
|
+
|
|
74
|
+
`[[{"text":"Yes","callback_data":"yes"},{"text":"No","callback_data":"no"}]]`
|
|
75
|
+
|
|
76
|
+
The system strips this markup from the visible text and renders native tappable buttons.
|
|
77
|
+
|
|
78
|
+
Example — instead of writing:
|
|
79
|
+
|
|
80
|
+
> Choose a type:
|
|
81
|
+
> 1. String
|
|
82
|
+
> 2. Keyboard
|
|
83
|
+
> 3. Percussion
|
|
84
|
+
|
|
85
|
+
Write:
|
|
86
|
+
|
|
87
|
+
> Choose a type:
|
|
88
|
+
> [[{"text":"String","callback_data":"s"},{"text":"Keyboard","callback_data":"k"},{"text":"Percussion","callback_data":"p"}]]
|
|
89
|
+
|
|
90
|
+
Do NOT use `[[Text]]` format — only `[[{"text":"...","callback_data":"..."}]]` works.
|
|
91
|
+
|
|
66
92
|
## Writing Style (Bitrix24)
|
|
67
93
|
|
|
68
94
|
- Direct, professional, moderate length.
|
|
69
|
-
- **Always reply in the same language the user writes in.** If the user writes in
|
|
95
|
+
- **Always reply in the same language the user writes in.** If the user writes in Polish, reply in Polish. If in English, reply in English.
|
|
70
96
|
- Bitrix24 uses BBCode for formatting (conversion is automatic).
|
|
71
|
-
-
|
|
97
|
+
- Prefer inline buttons over numbered lists when presenting options.
|
package/src/channel.ts
CHANGED
|
@@ -538,7 +538,12 @@ export interface ChannelButton {
|
|
|
538
538
|
/**
|
|
539
539
|
* Convert OpenClaw button rows to B24 flat KEYBOARD array.
|
|
540
540
|
*/
|
|
541
|
-
export function convertButtonsToKeyboard(
|
|
541
|
+
export function convertButtonsToKeyboard(input: ChannelButton[][] | ChannelButton[]): B24Keyboard {
|
|
542
|
+
// Normalize: accept both [[btn, btn], [btn]] (rows) and [btn, btn] (flat)
|
|
543
|
+
const isNested = input.length > 0 && Array.isArray(input[0]);
|
|
544
|
+
const rows: ChannelButton[][] = isNested
|
|
545
|
+
? (input as ChannelButton[][])
|
|
546
|
+
: [input as ChannelButton[]];
|
|
542
547
|
const keyboard: B24Keyboard = [];
|
|
543
548
|
|
|
544
549
|
for (let i = 0; i < rows.length; i++) {
|