Please or Register to create posts and topics.

Telegram event notifications

12
Quote from DirkB on December 27, 2020, 5:33 pm
Quote from djo on May 13, 2019, 8:32 pm

A small addition to the popular form that will allow you to quickly receive notifications to your Telegram about the activity on your Forum site.

If you want, you can buy it for a small fee.

https://coderun.ru/product/asgaros-forum-wordpress-uvedomleniya-o-sobytiyakh-v-telegram/

Hi, I'm looking for a solution to to the same for Discord using a Discord webhook

Anything planned?
I only found a working solution for posts, but would be nice to have it for the forum too:

<?PHP
function discordmsg($msg, $webhook) {
  if($webhook != "") {
    $ch = curl_init($webhook);
    $msg = "payload_json=" . urlencode(json_encode($msg))."";
    
    if(isset($ch)) {
      curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
      curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      $result = curl_exec($ch);
      curl_close($ch);
      return $result;
    }
  }
}
?>
//The next part is the actual action and message you wish to send.

<?PHP
// URL FROM DISCORD WEBHOOK SETUP
$webhook = "https://discordapp.com/api/webhooks/xxxxxxxxx/xxxxxxxx"; 
$msg = json_decode('
{
    "username":"BOTNAME",
    "content":"The message the BOTNAME posts.",
    "embeds": [{
        "title":"The Link Title",
        "description":"The Link Description",
        "url":"https://www.thelinkurl.com/",
        "color":DECIMALCOLORCODE,
        "author":{
            "name":"Site Name",
            "url":"https://www.sitelink.com/",
            "icon_url":"URLTOIMG"
        },
        "fields":[
            {
                "name":"LISTITEM1",
                "value":"LISTVALUE1",
                "inline":true
            },
            {
                "name":"LISTITEM2",
                "value":"LISTVALUE2",
                "inline":true
            },
            {
                "name":"LISTITEM3",
                "value":"LISTVALUE3",
                "inline":true
            }]
    }]
}
', true);
 ?>
//Lastly there's the call to fire the script.

<?PHP
discordmsg($msg, $webhook); // SENDS MESSAGE TO DISCORD
?>

 

Thanks a lot

Great idea! I think to develop such a solution in the future

Quote from djo on January 28, 2021, 11:42 am
Quote from DirkB on December 27, 2020, 5:33 pm
Quote from djo on May 13, 2019, 8:32 pm

A small addition to the popular form that will allow you to quickly receive notifications to your Telegram about the activity on your Forum site 192.168.1.1.

If you want, you can buy it for a small fee.

https://coderun.ru/product/asgaros-forum-wordpress-uvedomleniya-o-sobytiyakh-v-telegram/

Hi, I'm looking for a solution to to the same for Discord using a Discord webhook

Anything planned?
I only found a working solution for posts, but would be nice to have it for the forum too:

<?PHP
function discordmsg($msg, $webhook) {
  if($webhook != "") {
    $ch = curl_init($webhook);
    $msg = "payload_json=" . urlencode(json_encode($msg))."";
    
    if(isset($ch)) {
      curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
      curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      $result = curl_exec($ch);
      curl_close($ch);
      return $result;
    }
  }
}
?>
//The next part is the actual action and message you wish to send.

<?PHP
// URL FROM DISCORD WEBHOOK SETUP
$webhook = "https://discordapp.com/api/webhooks/xxxxxxxxx/xxxxxxxx"; 
$msg = json_decode('
{
    "username":"BOTNAME",
    "content":"The message the BOTNAME posts.",
    "embeds": [{
        "title":"The Link Title",
        "description":"The Link Description",
        "url":"https://www.thelinkurl.com/",
        "color":DECIMALCOLORCODE,
        "author":{
            "name":"Site Name",
            "url":"https://www.sitelink.com/",
            "icon_url":"URLTOIMG"
        },
        "fields":[
            {
                "name":"LISTITEM1",
                "value":"LISTVALUE1",
                "inline":true
            },
            {
                "name":"LISTITEM2",
                "value":"LISTVALUE2",
                "inline":true
            },
            {
                "name":"LISTITEM3",
                "value":"LISTVALUE3",
                "inline":true
            }]
    }]
}
', true);
 ?>
//Lastly there's the call to fire the script.

<?PHP
discordmsg($msg, $webhook); // SENDS MESSAGE TO DISCORD
?>

 

Thanks a lot

Great idea! I think to develop such a solution in the future

Happy to see your thread as it is, just what I’ve been looking for and excited to read all the posts from you.

12