I have a wufoo form (survey) which goes out to different clients. On submit I want the wufoo form to call an Apex REST class on my Salesforce org and post data which will be created in a record for a custom object.
The Webhook URL is: https://myinstance.salesforce.com/services/apexrest/MySurveyClass
This is my code for the post:
@RestResource(urlMapping='/MySurveyClass/*')
global with sharing class SurveyWebhook {
@HttpPost
global static void getSurveyData() {
RestRequest req = RestContext.request;
System.debug('------------------- survey data from wufoo: ' + JSON.deserializeuntyped(req.requestBody.toString()));
}
}
I do not know the format of the POST data Wufoo is going to send. When I submit the form it gives an error for the webhook integration saying:
(401) [{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]
I believe this is because I am not sending the session id or some authorzation key. How do I do this? Also, how do I read the data from the POST body?