Tag Archives: Future Callout

Invoke Apex Callout From Process Builder

Sample Code:

public class ContactProcessBuilderHandler {
    
    @InvocableMethod 
    public static void sendContacts(List<Contact> conList) {
        string jsonData = JSON.serialize(conList);
        sendContactsToOracle(jsonData);
    }
    
    @future(callout = true)
    public static void sendContactsToOracle(string jsonData) {
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
        req.setEndpoint('https://your endpoint url');
        req.setMethod('POST');
        req.setHeader('Authorization', 'Authorization Header');
        req.setHeader('Content-Type', 'application/json');
        req.setBody(jsonData);
        req.setCompressed(true); 
		res = http.send(req);
    }
}