2019-10-04 05:18:43 -07:00
|
|
|
import {
|
2022-07-10 01:07:16 -07:00
|
|
|
ICredentialTestRequest,
|
2019-10-04 05:18:43 -07:00
|
|
|
ICredentialType,
|
2021-06-12 09:39:55 -07:00
|
|
|
INodeProperties,
|
2019-10-04 05:18:43 -07:00
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
|
|
|
|
export class TelegramApi implements ICredentialType {
|
|
|
|
name = 'telegramApi';
|
|
|
|
displayName = 'Telegram API';
|
2020-08-17 05:42:09 -07:00
|
|
|
documentationUrl = 'telegram';
|
2021-06-12 09:39:55 -07:00
|
|
|
properties: INodeProperties[] = [
|
2019-10-04 05:18:43 -07:00
|
|
|
{
|
|
|
|
displayName: 'Access Token',
|
|
|
|
name: 'accessToken',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2019-10-04 05:18:43 -07:00
|
|
|
default: '',
|
2022-04-13 23:32:27 -07:00
|
|
|
description: 'Chat with the <a href="https://telegram.me/botfather">bot father</a> to obtain the access token',
|
2019-10-04 05:18:43 -07:00
|
|
|
},
|
|
|
|
];
|
2022-07-10 01:07:16 -07:00
|
|
|
test: ICredentialTestRequest = {
|
|
|
|
request: {
|
|
|
|
baseURL: `=https://api.telegram.org/bot{{$credentials?.accessToken}}`,
|
|
|
|
url: '/getMe',
|
|
|
|
method: 'GET',
|
|
|
|
},
|
|
|
|
};
|
2019-10-04 05:18:43 -07:00
|
|
|
}
|