Hello. Sorry, for maybe stupid question. I wanna to test creating Lead in CRM via API in Postman. But I didn’t find information how it realise.
Hi Alex,
Welcome to Corteza!
You can use the integration gateway to send data to Corteza to a custom end point: Integration Gateway :: Corteza Docs
Then, that data could be parsed in a workflow and, for example, create a Lead: Workflow Processing :: Corteza Docs
Let me share the configuration of a workflow that parses data received via the integration gateway:
The workflow starts with a System trigger
Then we start to parse the JSON content received. First we get the response.
The second step of parsing the JSON is to cast it to a string.
And then we process the JSON string so that we can access it’s values like an object. This is done with the “Process arbitrary data in jsenv” function (which you can select in the function block).
The variables need to be:
- scope:
response
- source:
var response
try {
response = JSON.parse(input)
} catch (e) {
throw new Error('could not parse contact info payload: ' + e)
}
return response
(exactly like above)
Under results, in the same function block, you can return the variable response
, which is now an object of which you can access values, like lead.name or lead.email (whatever data you had in your JSON).
After these 4 workflow blocks you can continue to create the Lead record, update an existing one if an email matches, assign the Lead, etc.
Hope this helps.
Hello! Thanks a lot for reply. I tried it again and got stuck in Workflow. I think I missed some detail, but I can’t figure out which one. If I run a trigger with 4 blocks, I get an error on f(x)
And if run the trigger without this block, then the error appears on the first expressions
Where you inserted the code, there must be a toggle to turn of the evaluation of the content as an expression.
Figure 18 there has the screenshot with the toggle.
Function arguments can be passed in two different ways:
- Constant values which are passed into function in their present condition. Use constant values when the passed data should not change.
- Expressions are evaluated and the result is passed into function. This is useful when you wish to change the input without the need for an additional expression step.
Thanks for the answer.
But how to return JSON object after workflow complete? I keep on to receive empty JSON with Default JSON response defined in Integration Gateway
Hi @reidlai , you can prepare a JSON yourself (via String
) in workflow and then use the Response
post-filter.
Tried but no luck. I’ll try another way using compose api to see the result