-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from Cognigy/feature/telegram
Feature/telegram
- Loading branch information
Showing
2 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.