What is a write job?

A write job is a job where hotglue is writing data from your product to an integration. This is often referred to as reverse ETL.

For example, if you wanted to write Contacts from your product to a tenant’s Salesforce account, that would be an example of a write job in hotglue.

How do you configure a flow to support write jobs?

There are two types of flows that support write jobs:

  • v2 (bidirectional)
  • v1 (write)

This option is presented when you first create a flow, as shown below:

We generally recommend using v2 flows whenever possible as they simplify the process of configuring bidirectional integrations (cases where you want to both read and write data to a connector).

Trigger a write job via API

In some cases you may want to pass the data you want to write via API instead of using a source. This is particularly useful if there is an action a tenant does in your product that should immediately send data to an integration. There are two ways to do this:

Using the hotglue API source

You can configure your flow to have the hotglue API as the source. This enables you to trigger a job using the POST /jobs endpoint with a state object containing the data you wish to write. This will queue a write job to asynchronously write the data. The request is slightly different depending on whether you’re using a v2 flow or v1 write flow.

curl --request POST \
  --url https://client-api.hotglue.xyz/v2/{env_id}/{flow_id}/{tenant}/jobs \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "connector_id": "<string>",
  "job_type": "write",
  "state": {
    "Contact": [
      {
        "name": "Sam Altman",
        "email": "sam@openai.com",
        "type": "contact",
        "company_name": "OpenAI",
        "first_name": "Sam",
        "last_name": "Altman",
        "title": "CEO"
      }
    ]
  }
}'

Using the real-time write endpoint

Alternatively, you can use the real-time write endpoint, which sends the data synchronously. See demo below:

curl --request POST \
  --url https://client-api.hotglue.xyz/{env_id}/{flow_id}/{tenant}/connectors/{connector_id}/{stream} \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
	"data": {
		"externalId": "222316",
		"firstname": "Tay",
		"lastname": "Kolma",
		"email": "tay.kolma@starwars.com"
	}
}'

Features

hotglue has several out of the box features that make working with writes significantly easier. Read more about them below.

External Id

When writing data to a connector there are many cases where you may want to later update that same record again. A handful of systems (such as Salesforce and NetSuite) natively support the concept of an external id – this essentially allows you to use your own ID to reference an object rather than having to store the internal id of that system.

hotglue supports external id upserts natively in our target-hotglue-sdk – this means that even systems that do not natively support external ids can support external ids via hotglue.

Check out the demo below with HubSpot:

The other advantage of using an external id is that it makes it easy to parse the result of a write job, as the external id is returned back to you.

See the sample below where we are writing contacts to the HubSpot connector:

{
	"data": {
		"externalId": "222316",
		"firstname": "Tay",
		"lastname": "Kolma",
		"email": "tay.kolma@starwars.com"
	}
}