Skip to content

sendDice

Send an animated emoji message with a random result, such as dice, darts, basketball, football, slot machine, or bowling.

Request

POST /:token/sendDice

Parameters

ParameterTypeRequiredDescription
chat_idInteger/StringYesUnique identifier or username of the target chat
business_connection_idStringNoUnique identifier of the business connection on behalf of which the message will be sent
message_thread_idIntegerNoUnique identifier of the target message thread (topic), for forum supergroups or private chats with forum topic mode enabled
direct_messages_topic_idIntegerNoIdentifier of the direct messages topic; required when sending to a direct messages chat
emojiStringNoEmoji on which the animation is based. Can be 🎲, 🎯, 🏀, , 🎰, or 🎳. Defaults to 🎲
disable_notificationBooleanNoSends the message silently. Users will receive a notification with no sound
protect_contentBooleanNoProtects the sent message content from forwarding and saving
allow_paid_broadcastBooleanNoAllows paid broadcasts up to 1000 messages per second for a fee of 0.1 Telegram Stars per message
message_effect_idStringNoUnique identifier of the message effect to add to the message, for private chats only
suggested_post_parametersObjectNoSuggested post parameters as a JSON-serialized object, for direct messages chats only
reply_parametersObjectNoDescription of the message to reply to
reply_markupObjectNoCustom keyboard, inline keyboard, keyboard removal, or force reply markup as a JSON-serialized object

Random Value Ranges

EmojiTypevalue Range
🎲Dice1-6
🎯Darts1-6
🎳Bowling1-6
🏀Basketball1-5
Football1-5
🎰Slot machine1-64

Response

Returns the sent Message object on success. The Message object contains a dice field.

json
{
  "ok": true,
  "result": {
    "message_id": 102,
    "from": {
      "id": 123456789,
      "is_bot": true,
      "first_name": "MyBot",
      "username": "my_bot"
    },
    "chat": {
      "id": 987654321,
      "first_name": "User",
      "username": "user123",
      "type": "private"
    },
    "date": 1700000000,
    "dice": {
      "emoji": "🎲",
      "value": 4
    }
  }
}

Error Codes

CodeDescription
400Bad request parameters, e.g. missing chat_id, unsupported emoji, or invalid reply_markup format
401Invalid or expired token
403Bot was blocked by the user or does not have permission to send messages to this chat
404Chat not found
429Too many requests, rate limit triggered
500Internal server error

Examples

Send Default Dice

bash
curl -X POST "https://api.safew.bot/<token>/sendDice" \
  -H "Content-Type: application/json" \
  -d '{
    "chat_id": 987654321
  }'

Send Basketball Animation

bash
curl -X POST "https://api.safew.bot/<token>/sendDice" \
  -H "Content-Type: application/json" \
  -d '{
    "chat_id": 987654321,
    "emoji": "🏀",
    "disable_notification": true
  }'

Mini Game with Inline Keyboard

bash
curl -X POST "https://api.safew.bot/<token>/sendDice" \
  -H "Content-Type: application/json" \
  -d '{
    "chat_id": 987654321,
    "emoji": "🎯",
    "reply_markup": {
      "inline_keyboard": [
        [
          {"text": "Play again", "callback_data": "dice_retry"},
          {"text": "Rules", "callback_data": "dice_rules"}
        ]
      ]
    }
  }'
  • Random mini games: Start lightweight interactions in private chats or groups with dice, darts, basketball, football, slot machine, or bowling animations.
  • Giveaways and decisions: Use dice.value as the random result for giveaways, ranking, or random selection.
  • Prediction challenges: Let users submit predictions first, then call sendDice to generate a public random result.
  • Group engagement: Combine reply_markup with buttons such as “Play again” or “Rules” for continuous interaction.
  • Business account interaction: Pass business_connection_id to send random interaction messages on behalf of a business account.