georgi170109

JS Function Send Message Through Webhook

Jan 9th, 2023 (edited)
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | Software | 0 0
  1. async function sendMessage(message) {
  2. const data = {
  3. content: message,
  4. };
  5.  
  6. const options = {
  7. method: 'POST',
  8. headers: {
  9. 'Content-Type': 'application/json',
  10. },
  11. body: JSON.stringify(data),
  12. };
  13.  
  14. const response = await fetch("INSERT_WEBHOOK_URL_HERE", options);
  15. return response.ok;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment