How to Integrate Telegram bot with Chapa

Posted on : 08 Apr, 2023    |    Last Update - 1 year ago   

We are excited to power Telegram Payments for Ethiopian Merchants. 

 

Configuring Telegram bot

Creating merchant bot

To create a Telegram bot, you complete the following steps:

  1. In the Telegram, interface find the BotFather bot (@botfather) and open the chat with it.
  2. In the chat window, type run the /newbot command and follow the bot's instructions.

By following these steps, you will create a token which is required to receive and send messages using the Telegram API. This token is a critical piece of authentication data which must be prevented from compromising.

 

Connecting to Chapa Test Bot

To connect the Chapa Test Bot (@ChapaPaymentsTestBot) to the merchant bot, complete the following steps:

  1. In Telegram, find the BotFather bot (@botfather) and open a chat with it.
  2. Inside the chat, run the /mybots command and select the bot you need from the list.
  3. In the bot configuration menu, click Payments, select Chapa, and then click Connect Chapa Test.
  4. In the open chat, click Start, and then follow the instruction.

 

Connecting to Chapa Live Bot

To connect the Chapa Test Bot (@@chapapayment_bot) to the merchant bot, complete the following steps:

  1. In Telegram, find the BotFather bot (@botfather) and open a chat with it.
  2. Inside the chat, run the /mybots command and select the bot you need from the list.
  3. In the bot configuration menu, click Payments, select Chapa, and then click Connect Chapa Live.
  4. In the open chat, click Start, and then follow the instruction.

By following these steps, you will create a payment token required to process test payments with the merchant bot. This token is a critical piece of authentication data which must be prevented from compromising.

Authentication with the Telegram service

Unlike any other payment methods, payments with the Telegram bot do not use digital signatures. Instead, authentication is performed by using authorization and payment tokens; authorization is a required token to send and receive messages through the Telegram API. A token is required to perform payments in test or production mode. An authorization token is generated when creating a merchant bot, and a payment token is generated when integrating the bot with Chapa.

The tokens are critical pieces of authentication data which must be prevented from compromising. If any token is compromised, you must generate a new one by following the instructions.

 

Once you have these keys, you can use them in your bot. 

 

Check out a very simplified example: https://github.com/Chapa-Et/chapa-telegram-bot-test-shop