A tiny snippet since I wasted 10 minutes going around the houses on this oneā¦
tl;dr: If you try to create a command that is not in lower case (e.g. Alert
not alert
) then the setMyCommands
API will return BOT_COMMAND_INVALID
Create a command for your Telegram bot:
curl --location --request GET 'https://api.telegram.org/botMY_TOKEN/setMyCommands' \
--header 'Content-Type: application/json' \
--data-raw '{
"commands": [
{
"command": "alert",
"description": "Define an alert to be sent if a carpark becomes available with greater than the defined number of spaces"
}
]
}'
{"ok":true,"result":true}
List commands for your Telegram bot:
curl --location --request GET 'https://api.telegram.org/botMY_TOKEN/getMyCommands'
{"ok":true,"result":[{"command":"alert","description":"Define an alert to be sent if a carpark becomes available with greater than the defined number of spaces"}]}