function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ryan Raymundo 1Ryan Raymundo 1 

Identifier name is reserved

Hello everyone,

I would like to ask how to handle this payload going to SF.

{
  "WebhookId": "1152",
  "MessageId": "79bfa6ba-b350-415f-ae29-8b98bc534b98",
  "To": "+11111111111",
  "From": "+12222222222",
  "Body": "Test Message",
  "Attachments": [],
  "MessageEventType": 1,
  "MessageStatus": 2,
  "Time": "2023-09-01T17:08:43.3133"
}

Since this is a webhook I do not have control over the fields. Now I'm getting errors for "From" and "Time" fields because it's reserved.

This does not work as well because of how the payload is structured

@HttpPost
    global static String doPost( String requestBodyJson ) {
Map<String, Object> requestBodyMap = (Map<String, Object>)JSON.deserializeUntyped(requestBodyJson);
....

Anyone who has an idea would be greatly appreciated.

Thanks in advance,
Ry
 
Best Answer chosen by Ryan Raymundo 1
Ryan Raymundo 1Ryan Raymundo 1
Able to make it work but how can I make it public and able to handle webhook w/o auth or just even a basic auth?