Webhooks in Flow

This example shows Flow using webhooks to link GitHub issues with Salesforce cases. We walk through the integrations tab, specifying the webhook endpoint, catching the payload, and finally returning SObject data.

 


 

Note: after following this tutorial, we also recommend you secure the GitHub webhook by verifying signatures, per this Github integration example. In the meantime, let's get started.

 

Transcript:

Intro and demo

Here is a screen of Salesforce Cases on the left and a screen of GitHub Issues on the right.

 

Let's link these together using webhooks so that when a new issue is created a Case is created in Salesforce. There's the Case record. Let's show it again.

A new Issue is created in GitHub and the corresponding case in Salesforce.

 

Let's look at how to set this up in Streams.

 

Integrations tab

I'll go to the Integrations tab. This shows me all sites and communities in the org.

 

Enable webhooks by Site

First I will tick Site B to enable webhooks. Then we will follow the instructions on how to set one up from scratch.

 

 

New Webhook Flow

This is a webhook flow.

For the first step I'm going to use a Streamscript action. This maps the webhook request to the case. I'll create a new case.

 

Set fields in Streamscript

I'll set the Case Subject: From GitHub. Then I'll set the Case Description to be the entire webhook payload for now. I use the return keyword to give the case back so that the next step can insert it.

 

 

Case record save

Then my create record step is called Save Case and I choose the case record to insert.

 

Set the Flow API Name

When I save this flow, its API name will affect the endpoint for the webhook. So I go back to the instructions and copy this sample here. Instead of saying Your Path Here I want the webhook to be called GH for GitHub.

Click Save and click Activate. Then I can see it appearing in the Integrations tab.

This webhook URL is online, on the Internet ready for GitHub.

 

Copying the endpoint URL

I'll copy the URL and open GitHub.

 

 

GitHub repository settings

Here's the repo.

Every repo in GitHub has a settings page that supports webhooks.

 

Add webhook, JSON payload

I'll click Add Webhook, then I'll paste in my URL from earlier. Set the Content Type to JSON, and choose “send me everything”.

 

First test request

This immediately sends a test event to Salesforce. So we'll see one case already. There it is. 

And when I create new issues in GitHub, more cases will be created.

 

Summing up

So, summing up. I wanted to integrate GitHub issues with my Salesforce cases. On the salesforce side I created a Flow-based webhook listener. On the GitHub side we publish events to that webhook listener. And finally we can see results appearing as cases, which were triggered when GitHub created issues.

 

 

 

Getting started with Streamscript
Install from the Salesforce AppExchange
Package install link: /packaging/installPackage.apexp?p0=04tGA000005VVeA