get hooked on webhooks: restful integration with a world wide web of services
TRANSCRIPT
![Page 1: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/1.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/2.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/3.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/4.jpg)
Electronic Guides
https://sites.google.com/site/df2015guides/
![Page 5: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/5.jpg)
Understanding Webhooks Your first step to becoming a webhooker
![Page 6: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/6.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/7.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/8.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/9.jpg)
“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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/10.jpg)
Zapier the ultimate app connector
![Page 11: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/11.jpg)
DIY Webhooks 4 Salesforce
![Page 12: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/12.jpg)
Step 1 - Collect the data
![Page 13: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/13.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/14.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/15.jpg)
Step 2 - Process the data
![Page 16: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/16.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/17.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/18.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/19.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/20.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/21.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/22.jpg)
RequestBin
![Page 23: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/23.jpg)
Done testing? Set the URL to point to Salesforce
![Page 24: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/24.jpg)
3. Catching and Processing the Data
![Page 25: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/25.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/26.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/27.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/28.jpg)
The Apex REST Class
![Page 29: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/29.jpg)
The Apex REST Class
@HttpDelete
@HttpGet
@HttpPatch
@HttpPost
@HttpPut
![Page 30: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/30.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/31.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/32.jpg)
RequestBin
![Page 33: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/33.jpg)
Hurl.It
![Page 34: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/34.jpg)
The happy ending - Our form post inserted in Salesforce
![Page 35: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/35.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/36.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/37.jpg)
![Page 38: Get Hooked on Webhooks: RESTful Integration with a World Wide Web of Services](https://reader031.vdocuments.site/reader031/viewer/2022021923/5a6ed2127f8b9a7f7e8b4f61/html5/thumbnails/38.jpg)
Thank you