+ All Categories
Home > Technology > Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Date post: 29-Jan-2018
Category:
Upload: salesforce-developers
View: 866 times
Download: 0 times
Share this document with a friend
38
Salesforce 2015 Get Hooked on Webhooks Joseph Ucuzoglu [email protected] RESTFul integration with a world wide web of services Daisy Garcia [email protected]
Transcript
Page 1: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Salesforce 2015 Get Hooked on Webhooks

 Joseph Ucuzoglu  [email protected]

RESTFul integration with a world wide web of services

 Daisy Garcia  [email protected]

Page 2: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

  Learn what webhooks are and why we should care

  Demonstrate a powerful tool for creating webhook integrations

  Show both sides of the equation (creating the webhook for Salesforce and consuming that webhook via the Salesforce API)

  Provide you with PDF guides you can follow along with after the presentation

Our Objectives

Page 3: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Don’t Take Notes! ●  Too much information

●  PDF guides will be posted to the Chatter feed when the presentation completes.

●  Relax and have a good time

Page 4: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Electronic Guides

https://sites.google.com/site/df2015guides/

Page 5: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Understanding Webhooks Your first step to becoming a webhooker

Page 6: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

  AKA Web Callback; AKA HTTP Push API

  A simple event-notification via HTTP POST

  Payload Formats (Form Data, JSON or XML)

What are they? Webhooks

Page 7: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

1.  Consumer is responsible for polling the provider.

2.  Consumer must create communication according to API specification.

3.  Consumer must create code to consume API response.

On average over 98.5% of polls are wasted *http://resthooks.org/

How they work Standard API’s

Provider

Consumer

API

API

Page 8: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

1.  Provider makes an HTTP request (POST) to Consumer endpoint when an event occurs.

2.  Consumer must write the code to handle the HTTP request from provider

Zapier spends 66x more resources on polling than on webhooks.

*https://zapier.com/engineering/introducing-resthooksorg/

How they work Webhooks

Provider

Consumer

API

Page 9: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

 “I want my Google Form posts to populate records in Salesforce”

Our solution

HTTP POST

Page 10: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Zapier the ultimate app connector

Page 11: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

DIY Webhooks 4 Salesforce

Page 12: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Step 1 - Collect the data

Page 13: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Step 1 - Collect the data  The Standard Google form

  Standard Google Form

  3 Fields

  Submits results to Google Sheet

Page 14: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

All form-fields are represented.

Labels show in the first row.

Form submissions fill in each subsequent row.

Google also includes a Timestamp field.

Step 1 - Collect the data  The Google Sheet

Page 15: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Step 2 - Process the data

Page 16: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Step 2 - Process the data  Zapier (Step 1) - Trigger & Action

Page 17: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Step 2 - Process the data  Zapier (Step 2-3) Connect to Accounts

Page 18: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Step 2 - Process the data  Zapier (Step 4) Filter / Select Results

Page 19: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Step 2 - Process the data  Zapier (Step 5) Matching & Mapping

Page 20: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Step 2 - Process the data  Zapier (Step 6) Testing [Google Sheets]

Page 21: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Step 2 - Process the data  Zapier (Step 6) Testing [ Zapier Webhook]

Page 22: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

RequestBin

Page 23: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Done testing? Set the URL to point to Salesforce

Page 24: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

3. Catching and Processing the Data

Page 25: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

  Set up a public REST endpoint w/Salesforce

  Create the APEX REST Class

  Modify Public Guest User Security Settings

  Test your webhook using an API testing tool

Catching Webhooks w / Salesforce

Page 26: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Public REST APIs w/ Salesforce

https://developer.salesforce.com/blogs/developer-relations/2012/02/quick-tip-public-restful-web-services-on-force-com-sites.html

Page 27: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Generates API Endpoint Handles object dynamically Handles fields dynamically Less than 40 lines of code

The Apex Rest Class

Page 28: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

The Apex REST Class

Page 29: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

The Apex REST Class

@HttpDelete

@HttpGet

@HttpPatch

@HttpPost

@HttpPut

Page 30: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Make sure the guest user has permission to access to APEX script Guest User Profile Permissions

Page 31: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Useful Tools / Resources for Testing

Hurl.it

https://www.hurl.it/ http://requestb.in/

Page 32: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

RequestBin

Page 33: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Hurl.It

Page 34: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

The happy ending - Our form post inserted in Salesforce

Page 35: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Recap  & Next Steps

Webhooks are becoming increasingly popular You can use a tool like Zapier to create your own webhooks Make sure that your API endpoint is publicly accessible Tools like RequestBin and Hurl.It make development easier Dig into the resources we have provided you to experiment and learn more.

Page 36: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Resources  Available in the session Chatter feed & Website address below

https://sites.google.com/site/df2015guides/

Page 37: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services
Page 38: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services

Thank you


Recommended