PHP Form contact to Telegram Bot based on the official Telegram Bot API
-
Message @BotFather with the following text:
/newbot
@BotFather replie:
Alright, a new bot. How are we going to call it? Please choose a name for your bot.
Continue with the next steps (look at the image above):
- Assign a name
- Continue with the username finished in _bot that is available. example:
juantest_bot
-
Once the previous steps have been carried out, @BotFather responds with its respective HTTP TOKEN API.
-
Save your respective **HTTP TOKEN API **
-
Insert your TOKEN
<?php date_default_timezone_set('America/Bogota'); # Enter your **token** here: define('BOT_TOKEN', '**API-KEY**'); define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/'); #Do not modify
-
Next we have to know our telegram ID, there are different ways to do it. I recommend knowing, through this bot. It is much faster. GET ID - TELEGRAM
-
Already obtained our ID. We go to the code and put our ID
# Enter your Telegram ID here: define('TLG_ID', 'YOUR-ID');