Create Lead in CRM via API

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.

2 Likes

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:

  1. Constant values which are passed into function in their present condition. Use constant values when the passed data should not change.
  2. 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.
1 Like

Thanks for the answer.