Transform customer response before creating JSON body in Data Connectors?
I’m trying to implement a newsletter signup. User enters their email and if they want to be on the marketing list or the build announcments list. The way I have this setup in sendgrid is via a custom field request should be something like:
{
“email”: “john.doe@appleseed.com”,
“list”: “marketing”
}
Right now I can easily collect boolean values for if the user wants marketing or build announcments but I can’t see a way to transform that into the correct string to insert in the body. Thanks!
Page 1 / 1
@mercury2768 can you show the kind of body you’d want to build? Right now I don’t think I have all the info to answer
The list field could be one of several options, for example:
marketing
sales
build_announcements
another_label
What I’d like to do is map a user’s natural response to one of these list values. For instance, if I ask “What email newsletter would you like to subscribe to?” and the user replies “I want the release schedule”, I’d like to translate that into:
At the moment, it seems like the system only accepts the literal text the user provides (like an email address or a raw boolean), instead of allowing me to normalize their answer to a defined label.
@mercury2768 Would you be using Fin AI anywhere? Your question is very tricky to be honest. It feels like you want to interpret natural language, so I’d assume you want to use Fin. So 2 options. Fin and not Fin.
Personal opinion: Fin would be like using a sledgehammer to crack a nut if you don’t have any other Fin use here, but I’m bringing it only for the “natural language” detection part of your question.
Fin:
With Fin you would be able to use Fin tasks. You’d be able to define a step where you ask the customer what kind of newsletter they want to subscribe to, interpret that, and then create the proper input for your data connector. Here is some doc for Fin tasks. Bear in mind that it’s still Fin, so it costs 1$ (or so) for each solved conversation - Also right now Fin Tasks is still in managed availability so most likely not available yet for you https://www.intercom.com/help/en/articles/10257113-how-to-set-up-fin-tasks. Not sure if it’s a very recommended approach but it *could* do the job.
Another possibility if you’re using Fin, but again something Beta, is to use Fin Categories.
You could try to use a mix of Fin Guidance to “escalate” and stop replying whenever the customer mentions that they want to subscribe to the newsletter. You can then branch on either the categories identified, or the guidance that has been applied to escalate. Based on the branch, you would be able to call you data connector and pass whichever parameter you want to it.
Not Fin:
inside your workflow, use a “collect customer reply” action
branch on the response using the “message content” attribute
have all the possibilities in those branches. Since we’re not detecting natural language, you’d need to be very explicit
for each branch, call your data connector.
For the data connector, 2 options:
either create as many data connectors as you need with the proper hardcoded parameters
or create a data connector that makes use of a variable, and then pass the variable in the call of the data connector.
Hi Steeve,
Thanks for the reply! Sorry if this was not more clear but there is currently no way to pass a variable or data from a workflow to a data connector. Unless I’m missing something this is what official support said to me. This is all I need to do in the simplest way possible:
I just need to send it a custom variable if the user chooses a different newsletter option so that the variable could look like this:
Instead right now I have to create 3 separate data connectors which seems ridiculous to me.
You can pass data into the data connector yes, that’s why I’m mentioning it!
The reason for this “Map action inputs” action to be displayed is if you designed your data connector with a variable in it.
@Steeve Cayla THANK YOU. Intercom support said you couldn’t!
It’s a tough job to be up to date on everything, especially the little tiny details like that. Initially I thought that the “collect data inputs” was only available for Fin, and I randomly saw the action to map data input from one of their docs. At the end of the day you did great asking here!