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.
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.
I'll go to the Integrations tab. This shows me all sites and communities in the org.
First I will tick Site B to enable webhooks. Then we will follow the instructions on how to set one up from scratch.
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.
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.
Then my create record step is called Save Case and I choose the case record to insert.
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.
I'll copy the URL and open GitHub.
Here's the repo.
Every repo in GitHub has a settings page that supports webhooks.
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”.
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.
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=04tGA000005NDq5
Webhooks in Salesforce Flow |
Salesforce/Clockify Webhooks |
Reference Documentation |