Skip to content

Commit

Permalink
Merge pull request #22 from Cognigy/feature/telegram
Browse files Browse the repository at this point in the history
Feature/telegram
  • Loading branch information
alexteusz authored Mar 15, 2021
2 parents d7583e8 + 0d24122 commit b176b73
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
33 changes: 28 additions & 5 deletions endpoint/webhook/telegram/README.MD
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
# Description
This Transformer example demonstrates how to connect a custom Endpoint to Cognigy.AI. This could for example be a new platform that Cognigy.AI doesn't suport natively yet, or a custom built Endpoint such as a custom Webchat. In this example, the Transformer connects to the platform Telegram.
# Telegram

With this transformer function, a Cognigy.AI virtual agent can be connected the [Telegram Messenger](https://telegram.org).

# Usage
To use this Transformer, the first step is to create a Telegram Bot and copying the Bot Token into the TOKEN const in the ``transformer.ts`` file.
<img src="./telegram.svg" width="200">

Afterwards, a Webhook Endpoint has to be created in Cognigy.AI, since Telegram offer a webhook based API. The contents of the ``transformer.ts`` file can then be copied into the created Webhook Endpoint, and the ``Output Transformer`` and ``Input Transformer`` has to be ``enabled``.
## Set Up

In order to establish this connection, Telegram and Cognigy.AI need to be configured first.

### Cognigy.AI

On the Cognigy.AI side, the following steps need to be done:

1. Login to [Cognigy.AI](https://trial.cognigy.ai)
2. Create a new virtual agent
3. Navigate to <code>Deploy -> Endpoints</code> and create a new [Webhook Endpoint](https://docs.cognigy.com/docs/webhook)
4. Open the **Transformer Functions** section and enable:
1. *Abort on Error in Transformer*
2. *Enable Input Transformer*
3. *Enable Output Transformer*
4. *Enable Execution Finished Transformer*
5. Copy the source code from the [Transformer Code File](./transformer.ts) and paste it into the code field in Cogngiy.AI

### Telegram

Since the virtual agent is now able to handle Telegram messages, a so-called **Telegram Bot** needs to be configured and, last but not least, connected to the Cognigy.AI Webhook Endpoint URL.

1. [Create a new Application](https://core.telegram.org/api/obtaining_api_id)
2. [Register a Telegram Bot (Bot Father)](https://core.telegram.org/bots#3-how-do-i-create-a-bot)
3. [Set the Cognigy.AI Webhook Endpoint URL](https://core.telegram.org/bots/api#setwebhook)
1 change: 1 addition & 0 deletions endpoint/webhook/telegram/telegram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b176b73

Please sign in to comment.