The Connect block is a neat way to connect events from Loopify to a callback URL that you provide. It works like a “reverse API method” and provides real-time information that are happening in your Flow. Just drag & drop it to your Flow, adjust the right connections and see it do it’s magic live!
- Add the Connect block to your Flow
- Click on its settings to set the parameters
- To callback URL - a field where you need to provide where you would want this block to send the information. It usually is a link from your website, that is made “ready” to listen to any webhook calls. Add the full domain here, and note that the URL provided must start with the “http://” or “https://” prefix.
- including Contact fields - select which values from the Loopify fields will be sent to the callback URL. These work as ‘variables’, meaning that they will be converted to the actual contact data when they are sent. Example: Adding “First name” and “Last name” here would send the actual first and last name of each contact that reaches this block.
- Add Field+ - using this button, you can also add fixed fields. The names and values of these fixed fields are added by you, and their purpose is to further clarify the message that is sent to your provided callback URL. You can add more of these with the same Add Field+ button.
A quick example on how this block can be used in an actual Flow:
- Let’s say a Contacts block is connected to an Email communication block, and this email block is connected to the Connect block with the event onOpen. When you activate this Flow, the contacts will start receiving the email, and with each open (per contact) - the Connect (webhook) will be sending you information to the callback URL that you set.
Tip: Blocks after this block can be connected with onSuccess (the webhook was successfully executed) and onError (something went wrong in the process).
When the Connect block is triggered, a POST call (more methods are coming soon!) will be done to the callback URL, with the following payload:
Note: Placeholders are used in the example, but they will be changed with real values.
The signature can be used to validate the call.
The algorithm used can be written like this in c#:
var hmac = new HMACSHA256(Encoding.ASCII.GetBytes(flowId));
var sigBytes = hmac.ComputeHash(Encoding.ASCII.GetBytes(timestamp + token));
string sigString = BitConverter.ToString(sigBytes).Replace("-", "");
return signature.Equals(sigString, StringComparison.OrdinalIgnoreCase);
Note: FlowID is found in the URL while you are in the Flow editor (example: https://app.loopify.com/#/accountID/flow/flowID/edit).
The token string is a random GUID with a length of 36 characters.
That's all for setting it up! Now it's time to make some POST calls! 📞