<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How do I code a custom webhook in brainCloud?]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">As the subject implies - I am integrating my app with an external service that can call my app via webhooks.</p>
<p dir="auto">How would I hook this up using brainCloud?</p>
<p dir="auto">Ima.</p>
]]></description><link>https://forums.getbraincloud.com/topic/16/how-do-i-code-a-custom-webhook-in-braincloud</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 10:26:15 GMT</lastBuildDate><atom:link href="https://forums.getbraincloud.com/topic/16.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 27 May 2019 17:30:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How do I code a custom webhook in brainCloud? on Mon, 27 May 2019 17:57:25 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Here are the steps to setting up a webhook to call a custom cloud code script in brainCloud:</p>
<p dir="auto"><strong>Step 1 - Write your script</strong></p>
<ul>
<li>Go to <strong>Design | Cloud Code | Scripts</strong> and create your script</li>
<li>You might want to just start with a simple script that logs the incoming parameters (see sample below)</li>
<li>Be sure to enable the <strong>S2S callable</strong> field on the <strong>Details</strong> page.</li>
</ul>
<p dir="auto"><strong>Step 2 - Declare the webhook and link it to your script</strong></p>
<ul>
<li>Go to <strong>Design | Cloud Code | WebHooks</strong> and create your webhook</li>
<li>Link it to the script that you just wrote. If you don't see your script in the list, double-check the state of the <strong>S2S callable</strong> field</li>
<li>You can optionally restrict the webhook to be callable via a range of ip ranges (good for additional security)</li>
<li>Click <em>[Save]</em> and copy the webhook URL that gets generated</li>
</ul>
<p dir="auto"><strong>Step 3 - Go to the external service, and give it your webhook URL</strong></p>
<ul>
<li>This step varies by service of course.</li>
</ul>
<p dir="auto"><strong>Step 4 - Trigger the webhook to test</strong></p>
<ul>
<li>This also varies by service. You could use Postman to do it as well.</li>
</ul>
<p dir="auto"><strong>Step 5 - Confirm the structure of the incoming parameters</strong></p>
<ul>
<li>It is a bit difficult to figure out what a webhook will send you ahead-of-time</li>
<li>The simplest is to invoke the hook, and then examine the results</li>
<li>See the sample logging script below for an example</li>
<li>Then view the logged input data via <strong>Monitoring | Global Monitoring | Recent Errors</strong>. Be sure to enable <strong>Info</strong> -level messages, and click <strong>[Refresh]</strong></li>
</ul>
<p dir="auto"><strong>Step 6 - Complete the writing of your script</strong></p>
<ul>
<li>Now that you know how the parameters are being sent, you should be good to complete your script.</li>
<li>More info on webhook development here - <a href="https://getbraincloud.com/apidocs/apiref/?cloudcode#cc-ccscripts-webhooks" rel="nofollow ugc">https://getbraincloud.com/apidocs/apiref/?cloudcode#cc-ccscripts-webhooks</a></li>
<li>Good luck!</li>
</ul>
<hr />
<p dir="auto">Sample script - just dumps parameters:</p>
<pre><code>var response = {};

bridge.logInfoJson("Script invoked from webhook. Contents of data...", data);

// Return the webhook response
response.statusOverride = 200;
response.jsonResponse = {};

response;
</code></pre>
<p dir="auto">Note - you can also view the request sent and response received from your webhook via the <strong>Server Logs</strong>. For more information on brainCloud logs - see this <a href="http://help.getbraincloud.com/features-and-apis/how-do-i-view-braincloud-logs" rel="nofollow ugc">knowledge base</a> article.</p>
<p dir="auto">Hope that helps!</p>
<p dir="auto">Paul.</p>
]]></description><link>https://forums.getbraincloud.com/post/27</link><guid isPermaLink="true">https://forums.getbraincloud.com/post/27</guid><dc:creator><![CDATA[Paul Winterhalder]]></dc:creator><pubDate>Mon, 27 May 2019 17:57:25 GMT</pubDate></item></channel></rss>