Google Tag Manager

Forum Discussion

db-origin's avatar
db-origin
Active Member II
2 years ago

Dynamic API Triggered Canvas

I want to trigger a Canvas using an API but also have that Canvas fire a Webhook message at the end of processing.

I would like to pass in some information in the API trigger payload that would dynamically switch the Canvas between two webhook messages. Since I cant use an api_triggered_property in a webhook message URL, I need another way to dynamically set a callback URL for the inbound API call.

Is there any way to use an api_triggered_property in an API Triggered Canvas to make a decision within that Canvas?

Any workarounds that anyone can share?

Thanks
Darren

  • Hey Darren,

    Looks like you can use API Trigger Properties in the Webhook URL field. And interestingly, since the URL field is a long text input, you can do all sorts of things using Liquid (fun!). How does the second screenshot look as a potential solution?

    If reporting is important and you need to use two separate message steps, then you should be able to apply the exact same process/logic that I wrote in this blog below. We use the User Update step to log the necessary data as a custom attribute, which you can then use to set up the Audience Path to differentiate the Webhook URLs. 

    https://www.blog.fornowmarketing.com/blog/braze-step-by-step-guide-split-users-based-on-canvas-entry-property

    Lmk if you have any questions! 

    Allan

  • db-origin's avatar
    db-origin
    Active Member II

    Thanks AllanHeoFNM - this looks like some great info. Let me have a tinker and see what I come up with đź‘Ť

  • db-origin's avatar
    db-origin
    Active Member II

    Unfortunately I get this error when I try using the above in Webhook URL

     

    Warning: Error saving your Canvas due to error on step Send Webhook: Invalid URL {% if {{canvas_entry_properties.${active_instance}}} == "proda" %} https://webhook.site/12135b8b-c085-4019-979c-x {% elsif {{canvas_entry_properties.${active_instance}}} == "prodb" %} https://webhook.site/12135b8b-c085-4019-979c-x {% endif %}

     

     

    • db-origin's avatar
      db-origin
      Active Member II

      Hi AllanHeoFNM - Its not Darren T sorry - its Darren B 🙂 I've chatted to you on the old Slack groups previously

      I did some more testing what what I was after and rather than fixing the result to two static URLs, I decided to pass in the URL via the API call as a callback URL parameter: canvas_entry_properties.${callback_url} 

      However, I found that there is some restriction on what you can put in the Webhook URL field. It seems to always want a HTTP scheme as a minimum e.g.

      https://{{canvas_entry_properties.${callback_url}}}  (Saves OK)

      {{canvas_entry_properties.${callback_url}}} (Throws error on Save)

      Cheers

      Darren

      • AllanHeoFNM's avatar
        AllanHeoFNM
        Strategist II

        Haha ahh, thanks for clarifying! 

        And super helpful. Thanks for sharing! Best of luck with the cool use case!