How to get notified of a new lead in SalesForce? [closed]
Asked Answered
M

5

20

I want to get notified when a new lead is created in Salesforce. Is there something like webhook in Salesforce or some other way to achieve this?

Middleclass answered 29/10, 2012 at 12:31 Comment(0)
B
23

Yes, plenty of options :)

For Salesforce as actor:

  1. Workflow rule that would fire on insert of Lead and send you an email (or if it's for system integration - outbound message).
  2. You can always write an "after insert" Apex trigger and have in it a callout to external system (SOAP and RESTful APIs are supported). Although you'll need a @future annotation because the triggers by default aren't supposed to send callouts (the database commit/rollback shouldn't depend on whether the external system has accepted the message or not).

For external system as actor:

  1. Simply poll every once in a while for something like [SELECT Id FROM Lead WHERE CreatedDate > :lastTimeIhaveChecked]
  2. Or there's fairly recent addition called Streaming API. Basically you define a PushTopic (query that interests you). Salesforce peeks at the current results returned by it and whenever the results change you'll get a notification. I haven't played with it yet but seems from the docs you can set event type to show "created" events only. This might be closest to a webhook.
Brophy answered 29/10, 2012 at 15:12 Comment(4)
Thanks eyescream, let me try Streaming API because my purpose is to integrate with external system and its much closest to webhookMiddleclass
This usually involves writing your own code to "subscribe to" events, construct a message and send it to an external endpoint. I have written quite extensively on this topic here: beachmonks.com/posts/integrations/salesforce/…. The source code is at: github.com/beachmonks/choir-salesforceWeakly
@AlexDong - feel free to post is as another answer, it's worthy of few upvotes!Brophy
Have a look at ProcessBuilder for a declarative approach. There is also a 'notification' capability now: salesforcecodecrack.com/2019/06/send-custom-notifications.htmlSteck
L
12

I hate to self-promote but since some might fine this as a useful answer... I built a Webhook creator for Salesforce. It is open source: https://github.com/jamesward/salesforce-webhook-creator

Lashaunda answered 30/6, 2014 at 22:11 Comment(3)
First link points to this thread, second link points to a scala app with no readme. Is the first link incorrect?Jerome
Thanks! Is there a way to get one of these webhooks working so that when our sales guys convert a lead to a contact, we get a post with the old lead id and the new contact id?Jerome
I think this might be possible but some testing would have to be done. And maybe a settings tweak. It seems that the Enable Validation and Triggers from Lead Convert option might need to be selected: help.salesforce.com/…Lashaunda
W
1

This usually involves writing your own code to "subscribe to" events, construct a message and send it to an external endpoint. I have written quite extensively on this topic at: http://beachmonks.com/posts/integrations/salesforce/practical-guide.html. The source code is at: http://github.com/beachmonks/choir-salesforce.

Weakly answered 19/3, 2014 at 7:52 Comment(1)
The links for your answer are broken. Can you fix?Payable
P
1

Salesforce does support webhooks, but they are just called by a different name - Callouts.

Here's a link to the Developer documentation on the topic:

Invoking Callouts Using Apex

Here's a description of the feature taken directly from the link above:

An Apex callout enables you to tightly integrate your Apex with an external service by making a call to an external Web service or sending a HTTP request from Apex code and then receiving the response. Apex provides integration with Web services that utilize SOAP and WSDL, or HTTP services (RESTful services).

(emphasis added)

This is basically a webhook, commonly defined as "a user-defined callback over HTTP" 2

Package answered 24/6, 2016 at 4:28 Comment(0)
F
0

There is another way. Use RoundRobin logic to assign new incoming leads. Then create a new WF rule to send notification to new owners plus Admin or who ever else wanted to be notified.

Feoff answered 22/5, 2015 at 2:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.