SOLVED

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

Go to solution
ktronolone
Level 3

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

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]"}]
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

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

You don't put quotes around tokens. The JSON encoding is done when the payload is assembled.

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

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

You don't put quotes around tokens. The JSON encoding is done when the payload is assembled.
ktronolone
Level 3

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

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