Skip to content

Instantly share code, notes, and snippets.

@TheGarkine
Last active April 9, 2022 22:15
Show Gist options
  • Select an option

  • Save TheGarkine/22f93c0c3255ff07b71a4196393382da to your computer and use it in GitHub Desktop.

Select an option

Save TheGarkine/22f93c0c3255ff07b71a4196393382da to your computer and use it in GitHub Desktop.
const email = document.getElementById("contactEmail").value;
const message = document.getElementById("contactMessage").value;
const text = encodeURIComponent(`Email: ${email}\n\n---Message below---\n${message}`);
const url = `https://api.telegram.org/bot${botApiKey}/sendMessage?chat_id=${chatID}&text=${text}`;
const request = new XMLHttpRequest();
request.open( "GET", url, false ); // false for synchronous request
request.send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment