
That callback URL is exposed in the Node.js app as a custom HTTP route, a concept that we explained in the second blog post of this series. If the login is successful, you are redirected to a callback URL. When you click on the “Authorize with Salesforce” button, you’re redirected to the Salesforce org in which the Salesforce portion of the app is deployed, so you can log in with your credentials. If that is not the case, you are prompted to authorize with Salesforce. When you open Ready to Fly, the Node.js app checks to see if you’ve authorized with Salesforce in the past. For example, if the Slack user “Marc Benioff” submits a travel request, the owner of the travel request record that gets created in Salesforce should be the Salesforce user for “Marc Benioff.” In order to do that, we implemented the OAuth 2.0 Web Server Flow for Web App Integration (commonly known as the “user-to-user” flow). One requirement of Ready to Fly (and probably 90% of these kind of apps) was the ability to perform operations in Salesforce on behalf of each individual user. Obtaining authorization with the user-to-user flow In order to do that, JSforce needs to authorize a connection with Salesforce that can be done using different authorization flows. For instance, you can use JSforce to query and insert Salesforce records. JSforce is a JavaScript library that allows you to use the Salesforce APIs. Part 4 – Local Development and DebuggingĪs we promised at the beginning of this series, in this post we’ll focus on explaining how the Node.js app interacts with Salesforce using the library JSforce.Note: some parts of this app have been live coded by my colleagues Mohith Shrivastava and Kevin Poorman in their codeLive video series: Building with Slack.Ĭheck out the rest of the blogs in this series here:


Learn along with us while we build Ready to Fly, our new sample app for submitting and approving travel requests in Salesforce without leaving Slack. This is the third blog post of a series in which we cover the whole process of creating a Slack app that integrates with Salesforce from scratch. This is the third blog post of a five-part series.īuilding a Slack app that integrates with Salesforce involves some challenges, such as knowing the right integration capability to use on each case, picking the right authorization flow, and implementing it securely.
