logo
Use this method to send a video to a chat (user, group, or channel). The media file must be uploaded first to obtain a media_id before sending the message.
  • If the video has no sound track, the message will be sent as an animated GIF.

Field
Type
Required
Description
method
String
Yes
"sendTextFile"
app_id
String
Yes
App Id to which the message belongs.
chat_id
String
Yes
Unique identifier for the target Chat or User_id.
to_user_id
String
Optional
Unique identifier of the target user. If the user replies or sends a message to the target user, it will be displayed within a Group or Channel.
video
String
Yes
Video: First, upload the media to the nandbox media server and obtain a media_id. Pass the media_id as a string to send the video. The download link for the video will be available for streaming.
caption
String
Optional
Video caption: 0-256 characters.
reference
Long
Yes
Unique local identifier for the message.
reply_to_message_id
String
Optional
Unique identifier for the original parent message. Use it when the message is a reply.
echo
Integer
Optional
If set to 1, returns a copy of the message to the sender. Default is 0.
disable_web_page_preview
Boolean
Optional
Disables link previews for links in this message.
disable_notification
Boolean
Optional
Sends the message silently; users will receive a notification with no sound.
menu_ref
String
Optional
Menu reference for an existing predefined menu: The menu will be displayed as an inline menu associated with the message.
inline_menu
Array of Menu
Optional
Inline menu object to hold menus. If both inline_menu and menu_ref are defined, the priority goes to inline_menu.
chat_settings
Integer
Optional
Administrators can chat with the bot privately, unlike normal users. In settings, the Bot Manager section allows admins to send commands. Setting chat_settings=1 reroutes messages to the Bot Manager for administrative communication.

Preconditions for API Functionality

The following tables outline the preconditions that must be met for the API to function correctly. Failure to meet these conditions may result in errors or unexpected behavior.
  • Preconditions for API permissions
Before sending or replying to a message, ensure the following conditions are met:
Action
Required Permission
Description
Sending a message
"Send Message"
The API must have the "Send Message" permission to send messages in a chat (user, group, or channel).
Replying to a specific message
"Reply to Message"
The user must have the "Reply to Message" permission to respond to a specific message within a chat.
  • Preconditions for API Role in the Chat
Before sending messages, the API must meet the following status requirements based on the type of chat:
Chat Type
Required API Role
Description
User Chat
User Pre-Joined
The user must have pre-joined (started) the API (bot) before receiving messages.
Group Chat
Member
The API must be a member of the group to send messages.
Channel
Admin
The API must be an admin in the channel to send messages.

Response

✅ The messageAck method is always returned on success.
  • If echo = 1, → An additional response is returned with the message method, containing a copy of the sent message object.
  • If the chat type is a user chat, → Two additional responses are included:
    • messageDelivered—Confirms that the message was received by the user's device.
    • messageSeen—Confirms that the user has read the message.
This process ensures proper acknowledgment and tracking of message status.

Example 1:

The media is video.

Requests

json
{ "method": "sendVideo", "chat_id": "90089584764538542", "reference": 111111132, "app_id": "90090684293000559", "video": "null0500528c7c90a28738dda631057914e9d1cde789e8ca180f40798aacc8830eb9.mp4", "echo": 1 }
java
if (incomingMsg.getText().toLowerCase().equals("video")) { String uploadedVideoId = MediaTransfer.uploadFile(TOKEN, System.getProperty("user.dir") + "/src/main/resources/upload/recallTest.mp4"); VideoOutMessage videoMsg = new VideoOutMessage(); videoMsg.setChatId(incomingMsg.getChat().getId()); videoMsg.setReference(Utils.getUniqueId()); videoMsg.setCaption("Video From Bot"); if (uploadedVideoId != null) { videoMsg.setVideo(uploadedVideoId); api.send(videoMsg); } else { System.out.println("Upload Failed"); } }
javascript
MediaTransfer.uploadFile(TOKEN, "./null0500528c7c90a28738dda631057914e9d1cde789e8ca180f40798aacc8830eb9.mp4", config.UploadServer) .then((uploadedVideoId) => { let vidoMsg = new VideoOutMessage(); vidoMsg.chat_id = incomingMsg.chat.id; vidoMsg.reference = Id(); vidoMsg.video = uploadedVideoId; vidoMsg.caption = "Video From Bot"; vidoMsg.echo = 0; api.send(JSON.stringify(vidoMsg)); }) .catch((e) => console.log("Upload failed", e));
python
napi.send_video("chatId","videoId",Utils.get_unique_id())

Responses

json
{ "method": "messageAck", "ack": { "reference": 111111132, "date": 1741965243929, "gmid": null, "message_id": "d1_5s004NY8126201" } }
json
{ "method": "message", "message": { "date": 1741965243929, "reference": 111111132, "chat": { "name": "My First API", "id": "90091783822039252", "terminal": "API", "type": "Bot", "version": "('0twD')" }, "sent_to": { "id": "90089584764538542" }, "message_id": "d1_5s004NY8126201", "style": 0, "from": { "name": "My First API", "id": "90091783822039252", "terminal": "API", "type": "Bot", "version": "('0twD')" }, "video": { "duration": 16021, "public_url": "https:\/\/m1.nandbox.ca\/v1\/AUTH_137b624a8e434c4e88e9be30fa5e7bed\/g\/null0500528c7c90a28738dda631057914e9d1cde789e8ca180f40798aacc8830eb9.mp4?temp_url_sig=ede98cb8df5b3f30eccfc4469f5b11c04dd95ee8&temp_url_expires=2058189243", "thumbnail": { "width": 256, "id": "null0500528c7c90a28738dda631057914e9d1cde789e8ca180f40798aacc8830eb9.mp4.thumb.jpg", "height": 144 }, "size": 19488087, "width": 1920, "id": "null0500528c7c90a28738dda631057914e9d1cde789e8ca180f40798aacc8830eb9.mp4", "height": 1080 }, "type": "video" }, "app_id": 90090684293000559 }
json
{ "reference": 111111132, "method": "messageDelivered", "message_id": "d1_5s004NY8126201" }
json
{ "method": "messageSeen", "message_ids": [ "d1_5s004NY8126201" ] }

Example 2:

The media is video without a soundtrack.

Requests

json
{ "method": "sendVideo", "chat_id": "90089584764538542", "reference": 111111134, "app_id": "90090684293000559", "video": "null207d773151b083689bf8236c48086707cc66103c0d35536199c6800c40fea84f.mp4", "echo": 1 }
java
if (incomingMsg.getText().toLowerCase().equals("video")) { String uploadedVideoId = MediaTransfer.uploadFile(TOKEN, System.getProperty("user.dir") + "/src/main/resources/upload/recallTest.mp4"); VideoOutMessage videoMsg = new VideoOutMessage(); videoMsg.setChatId(incomingMsg.getChat().getId()); videoMsg.setReference(Utils.getUniqueId()); videoMsg.setCaption("Video From Bot"); if (uploadedVideoId != null) { videoMsg.setVideo(uploadedVideoId); api.send(videoMsg); } else { System.out.println("Upload Failed"); } }
javascript
MediaTransfer.uploadFile(TOKEN, "./null207d773151b083689bf8236c48086707cc66103c0d35536199c6800c40fea84f.mp4", config.UploadServer) .then((uploadedVideoId) => { let vidoMsg = new VideoOutMessage(); vidoMsg.chat_id = incomingMsg.chat.id; vidoMsg.reference = Id(); vidoMsg.video = uploadedVideoId; vidoMsg.caption = "Video From Bot"; vidoMsg.echo = 0; api.send(JSON.stringify(vidoMsg)); }) .catch((e) => console.log("Upload failed", e));
python
napi.send_video("chatId","videoId",Utils.get_unique_id())

Responses

json
{ "method": "messageAck", "ack": { "reference": 111111134, "date": 1741966900872, "gmid": null, "message_id": "d1_agcSwWi3126215" } }
json
{ "method": "message", "message": { "date": 1741966900872, "reference": 111111134, "gif": { "duration": 300, "public_url": "https:\/\/m1.nandbox.ca\/v1\/AUTH_137b624a8e434c4e88e9be30fa5e7bed\/g\/null207d773151b083689bf8236c48086707cc66103c0d35536199c6800c40fea84f.mp4?temp_url_sig=8da08ea5232dd45bc8842db38b5511c77282daa7&temp_url_expires=2058190900", "thumbnail": { "width": 112, "id": "null207d773151b083689bf8236c48086707cc66103c0d35536199c6800c40fea84f.mp4.thumb.jpg", "height": 112 }, "size": 5877, "width": 112, "id": "null207d773151b083689bf8236c48086707cc66103c0d35536199c6800c40fea84f.mp4", "height": 112 }, "chat": { "name": "My First API", "id": "90091783822039252", "terminal": "API", "type": "Bot", "version": "('0twD')" }, "sent_to": { "id": "90089584764538542" }, "message_id": "d1_agcSwWi3126215", "style": 0, "from": { "name": "My First API", "id": "90091783822039252", "terminal": "API", "type": "Bot", "version": "('0twD')" }, "type": "gif", }, "app_id": 90090684293000559 }
json
{ "reference": 111111134, "method": "messageDelivered", "message_id": "d1_agcSwWi3126215" }
json
{ "method": "messageSeen", "message_ids": [ "d1_agcSwWi3126215" ] }

Powered by Notaku