Some classes to create outbound JSON webhooks.
- Tests...💥👍💪
- Maybe improve logging. 📑
- Permission sets❓
- UI/LWC app to create and monitor the webhooks? 📈
- Setup immediate mode/synchronous execution?❔❓
-
Pull the repo from github.
-
Deploy to your org.
-
Figure out the object permissions.
-
Insert a Webhook__c.
Account my_account = [SELECT Id, Name FROM Account LIMIT 1]; Webhook__c foo = new Webhook__c( URL__c = 'https://your_url_here.com', // Headers__c = '{"Content-Type": "application/json"}', <-- Headers can be optionally specified! Payload__c = JSON.serialize(my_account) // Object_Payload_Id__c = my_account.Id <-- This will send all fields available to user! ); insert foo;
-
Get the result:
{ "webhook_id": "a023l00000kvpfUAAQ", "timestampz": "2019-08-15T19:35:48.134-07:00", "queued_timestampz": "2019-08-15T19:35:46.000-07:00", "payload": { "attributes": { "type": "Account", "url": "/services/data/v46.0/sobjects/Account/0011N00001E6asMQAR" }, "Id": "0011N00001E6asMQAR", "Name": "A great company" }, "instance_url": "https://your_org_here.my.salesforce.com" }