Can pass trigger token with webhook? | Community
Skip to main content
Level 3
Feb 1, 2021 6:04 PM UTC
Solved

Can pass trigger token with webhook?

I am not well versed with webhooks, asking on behalf of a dev, can you pass trigger tokens like {{trigger.subject}} with webhooks?

Thank you!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Feb 1, 2021 7:00 PM UTC
Yes.

9 replies

Level 5
Feb 2, 2021 8:58 PM UTC

Another workaround I have found useful is to use the {{campaign.description}} token in webhooks so that the same webhook can be used for different smart campaigns but have different payloads or be sent to different endpoints by editing the description of the campaign sending the webhook

Translate
SanfordWhiteman
Level 10
Feb 2, 2021 9:33 PM UTC
I mean yeah... but a {{my.token}} for that would be less disruptive, allowing the Description to be used for its original purpose.
Translate
Level 5
Feb 3, 2021 7:32 PM UTC

What if you have multiple campaigns within a single program then a {{my.token}} won't work if you want to use a single webhook?

 

 

Translate
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Feb 1, 2021 7:00 PM UTC
Yes.
Translate
Level 3
Feb 3, 2021 7:36 PM UTC

We tried like in the screenshot below, got an error - 

Any suggestions?

Thank you!

 

Translate
SanfordWhiteman
Level 10
Feb 3, 2021 7:45 PM UTC
Well, you can't create correct JSON like that. The string field (the {[trigger.token}}) is going to be JSON-encoded, then you have it inside another JSON string = broken JSON.
Translate