Question

Do logics work with webhooks? (Affinity)


I have a type form which ask people to type their revenue (which is often in the millions). I then have a logic to divide this by 1000000 and webhook this to our CRM platform Affinity. This logic is this not being pushed through into my webhook to Affinity? The number they actually type in (so 3500000) is being passed through, rather than 3.5

In general I would like the people filling out the typeform to be able to type their revenue in millions (like 3.5) but Typeform can’t handle decimals (no idea why that’s a feature?)

Does anyone know if this can be fixed?

Thanks a lot


11 replies

Userlevel 7
Badge +5

Hi @GuinnessFunds Thanks for stopping by the community! You can pass form responses through a webhook, and this article here can walk you through using our webhook. Though, it’s important to note that our webhook won’t automatically reformat data, so if you need the data in decimals, you would need to do that outside of Typeform. 

Thanks but I’ve got the webhook working, it’s just the “Logic” of dividing by 1,000,000 isn’t being passed through. Is it not possible for Webhooks to include the logics?

 

Thanks a lot

Userlevel 7
Badge +5

Hi @GuinnessFunds You can’t pass the logic jumps through a webhook, but if you’re placing the divided value into something like a variable, that can pass through the webhook. 

Thanks for getting back to me. That’s all I’m trying to do, pass the divided value through the webhook. I feel like i have set this up already by putting in a rule for a few of my questions which ask for numerical figures. The rule is: Always Divide @score by 1000000. Should this not therefore be passed through the webhook? I’m confused why this is not working. Many thanks!

Userlevel 7
Badge +5

Hi @GuinnessFunds Ohhh got it. Then yes, the score variable should be passed along. Do you mind sending a screenshot of what you’re getting in the webhook and how you have that logic jump/scoring setup?

Or, our tech team can also log into your account and take a closer look at this by contacting them through email here

No problem, so the question is below:

and then the logic is here:

I’ll give an example from the webhook from this question. 

{ "id": "21QmUv5dgaqR", "ref": "9401cf5c-d2bf-4591-9743-29c5648be4d7", "type": "number", "title": "Revenue (£) for the last 12 months?", "properties": {}

answer

{ "type": "number", "number": 2240000, "field": { "id": "21QmUv5dgaqR", "type": "number", "ref": "9401cf5c-d2bf-4591-9743-29c5648be4d7" }

 

you can see the number here is still 2240000. Are you able to fi this or shall I contact the tech team? 

Thanks a lot!

James

 

Userlevel 7
Badge +5

Hi @GuinnessFunds Thanks for sharing that! The field referenced there is the number field shown in the screenshot, but the field where this number would be divided is the score variable. Do you mind showing what the score passes through as a value in the webhook? 

The score is not referenced in the Webhook code, only “number”. Is it possible to change this? When I look at the code for the webhook (when I go to Connect - Webhooks) you’re right, I don’t think the @score is referenced. However I am not sure how to change this in the Webhook or logic. Apoloiges if i’m making this more confusing.

Thanks 

Userlevel 7
Badge +5

Hi @GuinnessFunds No no, not at all! I’m probably confusing myself. 

It might be worth having the tech team take a closer look at this because they’ll be able to log into your account to first, check the setup with the score and second, look at previously sent webhooks. If that sounds like it might be more helpful, they can be contacted here

Userlevel 4
Badge +2

Hello @GuinnessFunds

I sent a reply to you via email just now. It appears that the answers to each of the questions wasn’t actually being added to the variable before the math (in this case, division) was being applied to the variable. I see that you’re trying to track a few different inputs, so multiple variables will help keep track of all of these scores/calculations. For this project, you’d want the Branching and Calculations flow to look like this:

Always add [answer to the number question] to [the variable]

Always [divide] [the variable] by [the number you’d like to divide it by]

The variable is your “bucket” to keep track of this number as it’s calculated, and the variable should be passable to your CRM. You can add custom variables under “logic” > “Personalize with Data.” 

I made a video demo for @GuinnessFunds in my email reply, but I created a shorter summary video to share here. It demonstrates the points above for others who may find this thread with a similar setup. 

Video → https://share.getcloudapp.com/L1uvPAvB 

Hope this helps!

Userlevel 7
Badge +5

Thanks so much, @ryan.terry !

Reply