diff --git a/doc/api.md b/doc/api.md
index a5f7a68..698ba9a 100644
--- a/doc/api.md
+++ b/doc/api.md
@@ -33,6 +33,7 @@ TelegramBot
* [.sendDocument(chatId, doc, [options], [fileOpts])](#TelegramBot+sendDocument) ⇒ Promise
* [.sendSticker(chatId, sticker, [options])](#TelegramBot+sendSticker) ⇒ Promise
* [.sendVideo(chatId, video, [options])](#TelegramBot+sendVideo) ⇒ Promise
+ * [.sendVideoNote(chatId, videoNote, [options])](#TelegramBot+sendVideoNote) ⇒ Promise
* [.sendVoice(chatId, voice, [options])](#TelegramBot+sendVoice) ⇒ Promise
* [.sendChatAction(chatId, action)](#TelegramBot+sendChatAction) ⇒ Promise
* [.kickChatMember(chatId, userId)](#TelegramBot+kickChatMember) ⇒ Promise
@@ -338,6 +339,21 @@ Use this method to send video files, Telegram clients support mp4 videos (other
| video | String
| stream.Stream
| Buffer
| A file path or Stream. Can also be a `file_id` previously uploaded. |
| [options] | Object
| Additional Telegram query options |
+
+
+### telegramBot.sendVideoNote(chatId, videoNote, [options]) ⇒ Promise
+Use this method to send rounded square videos of upto 1 minute long.
+
+**Kind**: instance method of [TelegramBot](#TelegramBot)
+**Info**: The length parameter is actually optional. However, the API (at time of writing) requires you to always provide it until it is fixed.
+**See**: https://core.telegram.org/bots/api#sendvideonote
+
+| Param | Type | Description |
+| --- | --- | --- |
+| chatId | Number
| String
| Unique identifier for the message recipient |
+| videoNote | String
| stream.Stream
| Buffer
| A file path or Stream. Can also be a `file_id` previously uploaded. |
+| [options] | Object
| Additional Telegram query options |
+
### telegramBot.sendVoice(chatId, voice, [options]) ⇒ Promise
diff --git a/src/telegram.js b/src/telegram.js
index ecf333e..98ffcfa 100644
--- a/src/telegram.js
+++ b/src/telegram.js
@@ -695,6 +695,31 @@ class TelegramBot extends EventEmitter {
return this._request('sendVideo', opts);
}
+ /**
+ * Use this method to send rounded square videos of upto 1 minute long.
+ * @param {Number|String} chatId Unique identifier for the message recipient
+ * @param {String|stream.Stream|Buffer} videoNote A file path or Stream.
+ * Can also be a `file_id` previously uploaded.
+ * @param {Object} [options] Additional Telegram query options
+ * @return {Promise}
+ * @info The length parameter is actually optional. However, the API (at time of writing) requires you to always provide it until it is fixed.
+ * @see https://core.telegram.org/bots/api#sendvideonote
+ */
+ sendVideoNote(chatId, videoNote, options = {}) {
+ const opts = {
+ qs: options
+ };
+ opts.qs.chat_id = chatId;
+ try {
+ const sendData = this._formatSendData('video_note', videoNote);
+ opts.formData = sendData[0];
+ opts.qs.video_note = sendData[1];
+ } catch (ex) {
+ return Promise.reject(ex);
+ }
+ return this._request('sendVideoNote', opts);
+ }
+
/**
* Send voice
* @param {Number|String} chatId Unique identifier for the message recipient
diff --git a/test/telegram.js b/test/telegram.js
index 3602753..ff07929 100644
--- a/test/telegram.js
+++ b/test/telegram.js
@@ -709,6 +709,44 @@ describe('TelegramBot', function telegramSuite() {
});
});
+ describe('#sendVideoNote', function sendVideoNoteSuite() {
+ let videoNoteId;
+ this.timeout(timeout);
+ before(function before() {
+ utils.handleRatelimit(bot, 'sendVideoNote', this);
+ });
+ it('should send a video from file', function test() {
+ const video = `${__dirname}/data/video.mp4`;
+ return bot.sendVideoNote(USERID, video, { length: 5 }).then(resp => {
+ assert.ok(is.object(resp));
+ assert.ok(is.object(resp.video_note));
+ videoNoteId = resp.video_note.file_id;
+ });
+ });
+ it('should send a video from id', function test() {
+ // Send the same videonote as before
+ assert.ok(videoNoteId);
+ return bot.sendVideoNote(USERID, videoNoteId, { length: 5 }).then(resp => {
+ assert.ok(is.object(resp));
+ assert.ok(is.object(resp.video_note));
+ });
+ });
+ it('should send a video from fs.readStream', function test() {
+ const video = fs.createReadStream(`${__dirname}/data/video.mp4`);
+ return bot.sendVideoNote(USERID, video, { length: 5 }).then(resp => {
+ assert.ok(is.object(resp));
+ assert.ok(is.object(resp.video_note));
+ });
+ });
+ it('should send a video from a Buffer', function test() {
+ const video = fs.readFileSync(`${__dirname}/data/video.mp4`);
+ return bot.sendVideoNote(USERID, video, { length: 5 }).then(resp => {
+ assert.ok(is.object(resp));
+ assert.ok(is.object(resp.video_note));
+ });
+ });
+ });
+
describe('#sendVoice', function sendVoiceSuite() {
let voiceId;
this.timeout(timeout);