Claim your Biolink Click Here
1 like 0 dislike
195 views
in Education & Reference by (1.6k points) | 195 views

1 Answer

0 like 0 dislike
Best answer

First Creating a new bot -> via https://t.me/botfather
Use the /newbot command to create a new bot. The BotFather will ask you for a name and username, then generate an authentication token for your new bot.

The name of your bot is displayed in contact details and elsewhere.

The Username is a short name, to be used in mentions and t.me links. Usernames are 5-32 characters long and are case insensitive, but may only include Latin characters, numbers, and underscores. Your bot's username must end in 'bot', e.g. 'tetris_bot' or 'TetrisBot'.

The token is a string along the lines of 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw that is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely, it can be used by anyone to control your bot.

BotFather, [09-08-2022 11:43]
Alright, a new bot. How are we going to call it? Please choose a name for your bot.

MARC, [09-08-2022 11:44]
oracle-cloud

BotFather, [09-08-2022 11:44]
Good. Now let's choose a username for your bot. It must end in bot. Like this, for example: TetrisBot or tetris_bot.

yourbotname_bot

Done! Congratulations on your new bot. You will find it at t.me/yourbotname_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.

Use this token to access the HTTP API:
5489378422:AAGZ9FRCkZorhHdhd&hd83JVe4XoIrve_E
Keep your token secure and store it safely, it can be used by

Get Update and chat ID

https://api.telegram.org/bot5489378422:AAGZ9FRCkZorhHdhd&hd83JVe4XoIrve_E/getUpdates

Send Message via HTTP API

https://api.telegram.org/bot5489378422:AAGZ9FRCkZorhHdhd&hd83JVe4XoIrve_E/sendMessage?chat_id=102456789&text=HIIIII

VIA PHP Function

vi func.php

<?php
function sendMessage($chatID, $messaggio, $token) {
    echo "sending message to " . $chatID . "\n";

    $url = "https://api.telegram.org/bot" . $token . "/sendMessage?chat_id=" . $chatID;
    $url = $url . "&text=" . urlencode($messaggio);
    $ch = curl_init();
    $optArray = array(
            CURLOPT_URL => $url,
            CURLOPT_RETURNTRANSFER => true
    );
    curl_setopt_array($ch, $optArray);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}

?>

vi send.php

<?php
include("func.php");
$token = "5489378422:AAGZ9FRCkZorhHdhd&hd83JVe4XoIrve_E";
$chatid = "102456789";
sendMessage($chatid, "Oracle DB is Down", $token);


?>
by (4.7k points)
0 0
SHELL SCRIPT
#!/bin/bash

if ping -c 1 YOUR_IP/Domain &> /dev/null
then
   #php /var/www/html/botApp/send.php
  echo 1
else
  php /var/www/html/botApp/send.php
fi

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
1 like 0 dislike
1 answer
asked Apr 15, 2014 in Education & Reference by Yogi (460 points) | 283 views
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
asked Jun 27, 2019 in Education & Reference by Simmi (820 points) | 278 views
1 like 0 dislike
1 answer

Where your donation goes
Technology: We will utilize your donation for development, server maintenance and bandwidth management, etc for our site.

Employee and Projects: We have only 15 employees. They are involved in a wide sort of project works. Your valuable donation will definitely boost their work efficiency.

How can I earn points?
Awarded a Best Answer 10 points
Answer questions 10 points
Asking Question -20 points

1,310 questions
1,471 answers
569 comments
4,809 users