Use webhook payload json as text and send the text to slack integration

Hi community,

I'm start to work with workflows and the webhook trigger. Therefor I need to see exactly how the payload looks like when it comes in through the webhook.

My idea was to connect the webhook trigger to my slack integration and let is send the json as raw text to slack. However, when I do this I only receive "[object Object]" which doesnt really help me.

image

I was searching how I can transform the object into text but wasnt able to find anything. I guess I'm not looking for the correct keywords.

Any help would be much appreciated!

Hey @Lukas! Could you try to console.log your json to see what it looks like so we know how to transform it? :slightly_smiling_face:

Workflows support console.log! It should print in your workflow logs.

Hej Victoria,

the log looks like this:

[Wed Jan 04 2023 20:53:43 GMT+0100] --- Running query: startTrigger ---

[Wed Jan 04 2023 20:53:43 GMT+0100] Evaluating JS query: startTrigger

[Wed Jan 04 2023 20:53:43 GMT+0100] --- Successfully finished running query: startTrigger ---

[Wed Jan 04 2023 20:53:43 GMT+0100] --- Running query: query3 ---

[Wed Jan 04 2023 20:53:43 GMT+0100] Evaluating JS query: query3

[Wed Jan 04 2023 20:53:43 GMT+0100] [log] { event_type: 'survey_response.updated', event_id: 'b8d057c59327541d7ec2104c0a9a255ad1997fb00831b9c6bbf09561e6d5cbd0', event_data: { id: '5435', person: { id: '5975', email: 'charlie_gravis@example.com', name: 'Charlie Gravis', created_at: 1672843814 }, survey_type: 'nps', score: 9, comment: 'Your service is fast and flawless!', permalink: 'https://app.delighted.com/r/5pFDpmlyC8GUc5oxU6USto5VonSKAqOa', created_at: 1672843874, updated_at: 1672844474, person_properties: null, notes: [], tags: [], additional_answers: [ [Object], [Object], [Object], [Object], '0': [Object], '1': [Object], '2': [Object], '3': [Object] ] } }

[Wed Jan 04 2023 20:53:43 GMT+0100] --- Successfully finished running query: query3 ---

[Wed Jan 04 2023 20:53:43 GMT+0100] --- Successfully finished running the workflow ---

Cool, so it looks like we have:

{ event_type: 'survey_response.updated', event_id: 'b8d057c59327541d7ec2104c0a9a255ad1997fb00831b9c6bbf09561e6d5cbd0', event_data: { id: '5435', person: { id: '5975', email: 'charlie_gravis@example.com', name: 'Charlie Gravis', created_at: 1672843814 }, survey_type: 'nps', score: 9, comment: 'Your service is fast and flawless!', permalink: 'https://app.delighted.com/r/5pFDpmlyC8GUc5oxU6USto5VonSKAqOa', created_at: 1672843874, updated_at: 1672844474, person_properties: null, notes: [], tags: [], additional_answers: [ [Object], [Object], [Object], [Object], '0': [Object], '1': [Object], '2': [Object], '3': [Object] ] } }

as our data object.

Which part of this data object would you like to send in your slack message?

{{startTrigger.data.event_data.comment}}

would give you the comment!

If you want to send the whole data object as a string, you could do something like:

{{JSON.stringify(startTrigger.data)}}

Would either of those work, or are you interested in accessing something else?

1 Like