InputKit
← Help center

Salesforce integration in Flow

Updated October 7, 2026

*Important, you must have Admin access and the Enterprise, Performance or Unlimited license to access the Flow tool.

Here are the 3 steps

  1. Authorize api.inputkit.io

  2. Create the Apex class for Send Sequence

  3. Use the Send Sequence in a Flow

1. Authorize api.inputkit.io in Salesforce

1.1. Setup

1.2. Remote Site Settings

1.3. Add api.inputkit.io in Remote Site Settings

Clique sur New Remote Site

Add this URL : https://api.inputkit.io

2. Create the Apex class "InputKit Send Sequence"

2.1 Apex Classes

2.2 New

Copy paste this code :

public with sharing class InputKitSendSequence {

@InvocableMethod(
label='Send InputKit Sequence',
description='Sends a sequence via InputKit API and returns the response'
)
public static List sendSequence(List requests) {
List results = new List();
Http http = new Http();

for (Request req : requests) {
String endpoint = 'https://api.inputkit.io/v3/send/' + EncodingUtil.urlEncode(req.sequenceId, 'UTF-8');

HttpRequest httpReq = new HttpRequest();
httpReq.setEndpoint(endpoint);
httpReq.setMethod('POST');
httpReq.setHeader('Content-Type', 'application/json');
httpReq.setHeader('inputkit_api_key', req.apiKey);

// Build body
Map body = new Map{
'location_id'     => req.locationId,
'creation_source' => req.creationSource
};

if (req.email        != null) body.put('email', req.email);
if (req.phone        != null) body.put('phone', req.phone);
if (req.firstName    != null) body.put('first_name', req.firstName);
if (req.lastName     != null) body.put('last_name', req.lastName);
if (req.fullName     != null) body.put('full_name', req.fullName);
if (req.honorific    != null) body.put('honorific', req.honorific);
if (req.locale       != null) body.put('locale', req.locale);
if (req.sendingModes != null) body.put('sending_modes', req.sendingModes);
if (req.timeToSend   != null) body.put('time_to_send', req.timeToSend);
if (req.employees    != null) body.put('employees', req.employees);
if (req.departments  != null) body.put('departments', req.departments);

httpReq.setBody(JSON.serialize(body));

ResponseWrapper wrap = new ResponseWrapper();
try {
HttpResponse res = http.send(httpReq);
wrap.statusCode = res.getStatusCode();
wrap.responseBody = res.getBody();
wrap.success = (res.getStatusCode() >= 200 && res.getStatusCode()  results =
InputKitSendSequence.sendSequence(
new List{ req }
);
Test.stopTest();

// Assertions
System.assert(results.size() == 1, 'One result expected');
InputKitSendSequence.ResponseWrapper wrap = results[0];
System.assert(wrap.success == true, 'Callout should be marked as success');
System.assert(wrap.statusCode == 201, 'HTTP status must be 201');
System.assert(wrap.responseBody.contains('Sequence sent'),
'Response body should contain our JSON message');
System.assert(wrap.errorMessage == null,
'No error message on success');
}

@IsTest
static void testSendSequenceFailure() {
// Prepare mock for a 400 Bad Request response
Test.setMock(
HttpCalloutMock.class,
new MockHttpResponseGenerator(400, '{"error":"Invalid payload"}')
);

// Build the minimal request
InputKitSendSequence.Request req = new InputKitSendSequence.Request();
req.sequenceId     = 'badSeq';
req.apiKey         = 'invalid_key';
req.locationId     = 0;
req.creationSource = 'TEST_FAIL';
req.employees = 'Employee test';
req.departments = 'Department test';

Test.startTest();
List results =
InputKitSendSequence.sendSequence(
new List{ req }
);
Test.stopTest();

// Assertions
System.assert(results.size() == 1, 'One result expected');
InputKitSendSequence.ResponseWrapper wrap = results[0];
System.assert(wrap.success == false, 'Callout should be marked as failure');
System.assert(wrap.statusCode == 400, 'HTTP status must be 400');
System.assert(wrap.responseBody.contains('Invalid payload'),
'Response body should contain the error message');
System.assert(wrap.errorMessage.startsWith('Non-2xx response'),
'errorMessage should describe status and body');
}
}

3. Use the SendSequence in any Flow

For this example, I will create a new Flow

3.1 Flows --> New Flow

Make sure to use an Async Path

3.2 Add an Action anywhere in the flow, under "Run Asynchronously"

3.3 Send InputKit Sequence (Apex)

3.4 Fill out the fields

The field value can come from the object that triggered the Flow, or from any other previous step in the Flow

Example, the customer's Last Name comes from the Triggering Case.

And I go to the Contact associated with the Case to take the Last Name.

Built with Alori