<p>I have a Discord channel. I want <code>Google Cloud Monitoring</code> to send notifications to this channel via <code>webhook</code>.</p>
<p>Help me please T.T</p>

<p>You can use the notification channel of webhook to send the notification to your discord.</p>
<p><a href="https://cloud.google.com/monitoring/support/notification-options#webhooks" rel="nofollow noreferrer">https://cloud.google.com/monitoring/support/notification-options#webhooks</a></p>
<p><a href="https://i.stack.imgur.com/Co3yp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Co3yp.png" alt="enter image description here" /></a></p>
<p><strong>Option 2</strong></p>
<p>If Stackdriver not sending the webhook directly you can simply leverage the pub/sub with a cloud function that would be an easy option and cost-efficient.</p>
<p><a href="https://i.stack.imgur.com/9sakk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9sakk.png" alt="enter image description here" /></a></p>
<p>Cloud monitoring alert will push the payload to <strong>pub/sub</strong> and write a simple cloud function which will consume the <code>pub/sub's</code> payload and <strong>send</strong> <strong>webhook</strong> to discord.</p>
<p>So flow will be something like : <strong><code>Stackdriver monitoring &gt; Pub/Sub &gt; CloudFunction (webhook hit to discord) &gt; Discord</code></strong></p>
<p><strong>Cloud function code</strong></p>
<pre><code>const fetch = require('node-fetch');
exports.helloPubSub = (message, context) =&gt; {
  const name = message.data
    ? Buffer.from(message.data, 'base64').toString()
    : 'World';

  console.log(`Hello, ${name}!`);
 
var URL = &quot;Discord URL&quot;;

fetch(URL, {
    'method': 'POST',
    'body': &lt;DARA&gt;,
    headers: data.getHeaders()
})
.then(res=&gt; console.log(res))
.catch(err =&gt; console.error(err));
    };
</code></pre>
<p><a href="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/HEAD/functions/helloworld/index.js" rel="nofollow noreferrer">Code ref</a> &amp; <a href="https://cloud.google.com/functions/docs/tutorials/pubsub" rel="nofollow noreferrer">Second Gen tutorial</a></p>
