Using Webhook to create SFDC Chatter: Failing when subjectID is a Marketo token | Community
Skip to main content
ktronolone
Level 2
March 11, 2024
Solved

Using Webhook to create SFDC Chatter: Failing when subjectID is a Marketo token

  • March 11, 2024
  • 1 reply
  • 1439 views

I've been building a webhook to create a new text-type chatter item in SFDC and it has worked perfectly when I manually specify the subjectID. However, If I attempt to replace this with a Marketo token, the webhook fails. Code and error messaging below.

 

Webhook template that works on my specified test record: 

 

{ "body" : { "messageSegments" : [ { "type" : "Text", "text" : "New Auto-MQL Action taken! Please follow up. " }, { "type" : "Mention", "id" : "0054u0000072xd5" }] }, "feedElementType" : "FeedItem", "subjectId" : "00QTH000002tBpi2AE" }

 

 

When I iterate and replace "subjectId" : "00QTH000002tBpi2AE" with "subjectId" : "{{lead.SFDC ID}}" so that: 

 

{ "body" : { "messageSegments" : [ { "type" : "Text", "text" : "New Auto-MQL Action taken! Please follow up. " }, { "type" : "Mention", "id" : "0054u0000072xd5" }] }, "feedElementType" : "FeedItem", "subjectId" : "{{lead.SFDC ID}}" }

 

I get error: Server Returned code 400 when run on the same person record.

[{"errorCode":"JSON_PARSER_ERROR","message":"Unexpected character ('\"' (code 34)): was expecting comma to separate OBJECT entries at [line:15, column:18]"}]
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman
You don't put quotes around tokens. The JSON encoding is done when the payload is assembled.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
March 11, 2024
You don't put quotes around tokens. The JSON encoding is done when the payload is assembled.
ktronolone
Level 2
March 11, 2024

Thanks so much, Sanford, that's exactly what I was doing wrong. I appreciate your quick help.