+ Start a Discussion
Bujji vBujji v 

HTTP callout

Hi,

I have a doubt in webhooks integration. I have created a webhook between campaign monitor and salesforce using salesforce site URL. According to campaign monitor webhooks concept they will POST a HTTP request in the format of JSON when any of the campaign monitor subscriber changes his state, and I am able to get the request in salesforce debug Log, But I am unable to read that JSON data.

 

My site have a class to read that HTTP Post request which is coming from campaign monitor but in that I am getting status code 400. My class is

 

public class HttpCalloutSample2 {

  public String getContent() {

    Http h = new Http();

    HttpRequest req = new HttpRequest();
    req.setEndpoint('http://MYSITEURL/");
    req.setMethod('GET');
    req.setHeader('Content-Length', '');
    system.debug('request:'+req.getBody());
    HttpResponse res = h.send(req);
    return res.getBody();
  }
}

 

I have given this class to public access and called this class in site's home page as controller.

 

 

Please Help me in this issue.

AdrianCCAdrianCC

Can you post here an example of what that response contains? Code + body?

 

Ty,

Adrian

Bujji vBujji v
It contains the HTML body of MYSITEURl