Send the Form Details Submission by users on your Telegram App.
https://getintotouch.sh20raj.com/api.php?id={//Your Telegram User ID}
First Enter your TELEGRAM USER ID and click on GET button to get Test message in your Telegram App.
Join @getintotouchbot
Paste your Telegram User ID here. Get your User ID from
https://telegram.me/userinfobot
and paste it below to obtain your API URL.
Set the API URL in the action attribute of your form and the
method as POST or create an AJAX/Fetch request on the API URL
https://getintotouch.sh20raj.com/api.php?id={//Your User ID}
to receive all data as a Telegram notification/messages.
from @getintotouchbot - https://telegram.me/getintotouchbot.
<form id="messageForm" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="form-group">
<label for="message">Message:</label>
<textarea class="form-control" id="message" name="message" rows="5" required></textarea>
</div>
<div class="form-group">
<label for="photo">Upload Photo/File:</label>
<input type="file" class="form-control-file" id="photo" name="photo">
</div>
<button type="submit" class="btn btn-primary">Send Message</button>
</form>
<script>
document.getElementById("messageForm").addEventListener("submit", function(event) {
event.preventDefault(); // Prevent the default form submission
const form = event.target;
const formData = new FormData(form);
fetch(window.apiurl || "https://getintotouch.sh20raj.com/api.php", {
method: "POST",
body: formData,
})
.then(response => response.json())
.then(data => {
// Handle the response data as needed
console.log(data);
if(data.status == 'success'){
// Optionally, display a success message to the user
alert("Message sent successfully!");
} else if(data.status == 'failed'){
alert("Message sent Failed!");
}
})
.catch(error => {
console.error("Error:", error);
// Optionally, display an error message to the user
alert("An error occurred while sending the message.");
});
});
</script>