PDA

View Full Version : Discord Notification Webhook


bathrobedave
03-18-2020, 04:43 PM
I've written a gapp script that polls a dedicated gmail account for new thread/post notifications which it then sends to Discord via webhook. Unfortunately it's not overly reliable (but better than RSS) and I've been looking at using curl to hook in at newpost_complete to send a webhook post and cut out the gmail/grscript middle man completely.

It doesn't seem to work at all. I know that curl is working on the server from a couple of tests outside of vbulletin.

Anyone else have anything like this working?

Test plugin, no joy, no error messages:

$url = "https://mywebhookurl";
$data = array("content" => $message, "username" => "Webhooks");
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
return curl_exec($curl);