The Inbound API block is enabled per environment. If the marketer does not see it in the orchestration canvas, contact your Lobyco representative.
Before you start
- A flow with an Inbound API block as its first block. The flow must be published, and the call must fall inside the block’s start and end dates. The marketer’s side is on Block reference.
- The block’s URL, in the form
https://your-environment.lobyco.net/inbound/{id}. The marketer finds it under Integration details in the block’s configuration, once the block is saved. - The API key for the environment. Lobyco provides one key per environment, and it works for every Inbound API block there. Ask your Lobyco representative for a key, or to rotate one. Pass the key and the URL on only through a secure channel.
- Valid Lobyco customer ids. Lobyco does not check the ids against the customer base, so send ids you know to be valid.
Choose the call
The same URL takes two kinds of request, and theContent-Type tells Lobyco which one it is. Both use the same API key.
You should send an audience as one file rather than one call per customer. A file starts a single run for everyone in it, while separate calls start one run each.
Send one customer
1
Send the request
Call the block’s URL with the API key in theAPI-KEY header and a JSON body:customerId, the Lobyco customer id to push into the flow. Required, and at most 36 characters.idempotencyKey, a value unique to this event, such as an order number. Optional, and recommended. See Idempotency keys.
CustomerId and IdempotencyKey still works.2
Read the response
A202 Accepted with a requestId means Lobyco accepted the call and scheduled the flow for that customer. Keep the requestId. It is how you trace the run with Lobyco.Send a customer list
1
Prepare the file
Write a CSV file with one customer per row. It can hold the customer ids alone, or the customer ids followed by extra columns of your own.With customer ids only, the header row is optional:CustomerId must be its first column:Lobyco accepts extra columns, but does not use them. They let you send a file in the format another system already exports, or reuse a file that also serves another purpose.
CustomerId is the default name of the customer id column. If your environment uses another name, such as MemberId, Lobyco tells you, and your file uses that name instead.Column names follow Lobyco’s file conventions and are in PascalCase, such as CustomerId. Only the JSON body of a single-customer call uses camelCase.2
Upload the file
Send the file to the block’s URL asmultipart/form-data, with the API key in the API-KEY header:API-KEY, the same key as for one customer. Required.Content-Type,multipart/form-datawith its boundary. Let your HTTP client set this header, so that the boundary matches the body. Required.Idempotency-Key, a value unique to this file. Optional, and recommended. See Idempotency keys.- One file part holding the CSV. Lobyco reads it whatever its field name, so
filein the example is only a convention. Other form fields are not read.
Expect: 100-continue with a large file. Lobyco can then refuse the request before your client sends the file, for example for a wrong API key. With curl, the header goes out by itself for files over 1 MB. In .NET, set request.Headers.ExpectContinue = true.3
Read the response
A202 Accepted with a requestId means the file passed every rule and Lobyco stored it. One run of the flow is scheduled for everyone in it. Keep the requestId to trace the run with Lobyco.Lobyco checks the file while it uploads. If the file breaks a rule, Lobyco refuses the request with 400, starts nothing and keeps nothing. The message names the problem and the row:What happens next
The flow runs on its own after the202 Accepted. The response does not mean the customers have their activity yet, and Lobyco sends no callback. The marketer follows the run in Nexus.
Each file is a run of its own. An audience larger than 100 MB goes in several files, and each file starts its own run. Lobyco does not compare a file with earlier ones, and nobody leaves the flow when they leave your audience. Sending the whole audience again starts the flow again for everyone in it. For an audience that changes over time, you should send only the customers who are new since the last file.
Lobyco keeps each uploaded file for 365 days, then deletes it.
Failure and edge cases
A call that does not return202 Accepted did not start the flow. Most error bodies carry a name and a message, as in the example above.
- Retries are yours. Lobyco does not retry a call. On a network error or a
5xx, retry with the same idempotency key. - A large upload refused early. Without
Expect: 100-continue, a large upload that Lobyco refuses before reading it can end in a dropped connection instead of a401. - A first row that is not a header. In a file of customer ids only, a first row with any value other than
CustomerIdis read as a customer id. A header named after another system’s column becomes one customer that matches nobody. - Keys come from Lobyco. Self-service key management and request logs are planned for later.
Idempotency keys
An idempotency key makes a retry safe. A repeated call with the same key, on the same block, within 24 hours does not start the flow again. It returns the originalrequestId instead.
- One customer: send the key as
idempotencyKeyin the body. A repeat with the same key for a differentcustomerIdis refused withInconsistentRetry. - Customer list: send the key in the
Idempotency-Keyheader. Lobyco does not compare the files, so a repeat returns the originalrequestIdeven for a different file. Use a new key for every new file. - A key serves one kind of call on a block. A key used for one customer is refused for a file on the same block, and the other way round.
- A refused request does not use up its key. Correct the request and send it again with the same key.
- A call without a key is always processed.
Related
- OutboundAPI connection — the other direction, where a flow calls an endpoint in your system.
- Block reference — what the marketer configures on the Inbound API block.
- Events — the payloads a flow can send on through the OutboundAPI connection.