exportChatInviteLink method

Future<String> exportChatInviteLink(
  1. dynamic chatId
)

Use this method to generate a invite link for a chat

Any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.

Returns the invite link as String on success.

https://core.telegram.org/bots/api#exportchatinvitelink

Implementation

Future<String> exportChatInviteLink(dynamic chatId) async {
  if (chatId is! String && chatId is! int) {
    return Future.error(TelegramException(
        'Attribute \'chatId\' can only be either type of String or int'));
  }
  var requestUrl = _apiUri('exportChatInviteLink');
  var body = <String, dynamic>{'chat_id': chatId};
  return await HttpClient.httpPost(requestUrl, body: body);
}