Forum Discussion
GET call to backend API in canvas?
Hello! I recently posted a question regarding a canvas, but our needs have shifted so I am starting a new post.
How/is it possible to make a GET call to our BE to retrieve the status of a user before deciding which path to send them on? Example:
-User creates an account, which triggers them to enter the canvas.
-They will have a 2 hour window to send an invite to their community and/or add a vehicle.
-After 2 hour window, GET call checks the BE for the status of said users.
-They are sent down the path according to status.
There are many different IFs that can be created if we are relying on event action triggers alone- so we are trying to simplify by calling the BE state for the user status.
- ArsoExpert
Hi! Can't you send the user status as a custom attribute on their Braze profile? That would be the easiest solution. Then, conditional statements take care of the rest.
You can make an API call using the following code:
{% connected_content YOURENDPOINT :save data %}
Replace the endpoint and add this to the email template within the canvas. "data" will be an object that contains the response of the API call. If the response is the status, then you can do operations using "data". Otherwise, if the response is a user object, you can say "data.status" to get the variable you need from the object, and so on.
Using conditional statements, you can define what the user sees based on the value of the variable from the API response.
Let me know if this helps.- PeytonFNMCollaborator
Hey Ashleedolan! Agreeing with Arso on this one that making a connected content call would be the best option.
For the Canvas setup, you could start with a 2-hour delay after entry. Then, add a user update step that pulls a value from a connected content call. If that value exists, you’d write it to the user’s profile as a custom attribute. From there, you can add a decision split step or audience path step looking for does the custom attribute = X? If yes, they go down Path 1; if no, they follow Path 2.- AshleedolanCollaborator
Thank you. There will actually be a few separate values that we are checking for - could I replace the decision split here with an audience path based on those custom attributes? For example:
- AshleedolanCollaborator
PeytonFNMPerfect. I will let you know if I have any other questions on this piece.
On another piece, users enter a canvas through the user_clicked event, decision split determines if they have the event property value "success", and sends them to a webhook endpoint /community-mgmt/{communityId}/bot .
The communityId is an event property linked to the user_clicked event. It's not currently a user attribute since they can have multiple communityIds -- however I need to be able to bring that communityId into the webhook itself. I tried filtering the segment on the event / event property is not null, but adding property filters here is not an option.
Would this be another user update step requirement prior to the webhook? OR if I specify the canvas action trigger user_clicked event where eventValues.community_id is not blank - how do I specify eventValues.community_id in the webhook?- AllanHeoFNMVisionary
Hi Ashleedolan ! Tag-teaming with my partner PeytonFNM on this one :)
You are absolutely correct about the User Update approach. Unfortunately, it's not possible to split users based on the Canvas Entry Property (the Braze community is looking forward to this becoming a feature one day), so the solution would be to log the Entry Property as a Custom Attribute, then you can split the users using the Audience Path afterwards.
We actually have a Youtube video on how to do exactly this: check it out here!
It also sounds like you'll be using some Liquid to create conditional logic based on what your GET request returns from your BE. The Connected Content approach is correct here. Also happy to take a look if you have some more details/examples!
- AshleedolanCollaborator
Thanks AllanHeoFNM ! Since the event property is being sent to Amplitude-->Braze as eventValues.community_id and the BE endpoint is referencing {communityId} - will there be a discrepancy in mapping the values if they don't match?
Since I have not added the user update step yet- I did attempt to alter the value with liquid in the webhook itself, but that did not work as I expected it would not.
Related Content
- 12 months ago
- 2 years ago