Enquiry - 5 Minutes Tutorial - API Integration
Prerequisites
The following information is required to be able to integrate with Authologic:
- Developer portal credentials,
- API Keys.
Developer Portal Credentials
The developer portal address and credentials were provided during onboarding.
Passwords And API Keys
During the onboarding you have received the API keys:
- API key allowing communication with Authologic.
- The key used to verify the data sent by Authologic by the callback mechanism.
Integration Overview
The entire process is called conversation. The following diagram represents the process logical flow:
- Start of the identity verification process. Your server calls the API method called: POST /api/conversations
- The response returns information about the address to which the user should be redirected
- Your system redirects the user's browser to the above URL
- The user fills the form data
- Authologic redirects the user's browser to a predefined page of your system
- Your server displays the return page
- Authologic calls a callback on your server's side with the result of the filled form
curl tool to show the API operation.
If you have not dealt with it, you can find a short guide on it here(opens in new tab).
Of course, there is nothing to prevent you from using the swagger tool directly, which you will find at the
link: here,
or any other tool, such as Postman or Insomnia.Creating a Conversation
So let's try using the curl tool to start a new conversation, which will include gathering of the enquiry form.
Basic Auth based authentication described, among others, at
here(opens in new tab). Username and API key should be used as data.
By using the curl tool we use the -u option which is responsible for the use of Basic Auth.curl -X POST -u my_login "https://sandbox.authologic.com/api/conversations" \
-H "Accept: application/vnd.authologic.v1.1+json" \
-H "Content-Type: application/vnd.authologic.v1.1+json" \
-d '{
"userKey": "7dfb9ded-c38f-49ae-95e2-307283a0b1f6",
"returnUrl": "https://id.sandbox.authologic.com/c/{conversationId}/thankYou",
"callbackUrl": "my_callback_url_here",
"strategy": "public:enquiry",
"query": {
"enquiry": {
"formId": "c1655381-b8c9-4598-b861-a6c4ac805504"
}
}
}'
Of course, instead of my_login enter your login. You should be prompted for a password - at that point you should
enter the API key (do not confuse it with the password to the customer panel).
For my_callback_url_here you could use https://webhook.site/(opens in new tab) to generate callback url which will be responsible for
receiving user information from Authologic. Whether you will use webhook.site or other similar tool it is crucial
that it will correctly receive http request since it is required for the process of identification.
Authologic requires you to provide the API version number by providing them as part of the expected document types.
Therefore, in the query, we used the appropriate Accept and Content-Type headers, thanks to which the server will be
able to choose the appropriate format and API version.
public:sandbox strategy, which does not perform real verification,
but allows you to select the result, which is convenient for implementation and integration. We suggest setting the
strategy parameter to public:sandbox in order to test the functionality during the integration process.userKey- the field which you can use to provide your own user identification information. Authologic returns this field in the conversation results, but doesn't use the value of the field. It is optional and will be generated for you if omitted.returnUrl- address to which the user will be redirected by Authologic after gathering the form data. It may contain the fragment:{conversationId}- if it exists, it will be replaced with the conversation ID.callbackUrl- after the process is completed, on this url we will send you user information or information that process has failed.strategy- information on how Authologic should perform the verification. This field is optional. If not specified, the system will use the default value. In our case, we used thepublic:enquirystrategy, which only gathers enquiry data and is convenient for implementation and integration tests.query- it is the query definition that contains the set of information we want to receive.enquiry- is the name of the product we want to ask for data.Enquiryspecifies custom information gathered form the user.formId- the identifier of the enquiry form that you want to display to the user. This field is optional. If not specified, the system will use the default form defined for you.
The response should look something like this:
{
"id": "7bde4014-7144-4090-93fd-d839e840877b",
"userKey": "7dfb9ded-c38f-49ae-95e2-307283a0b1f6",
"url": "https://sandbox.authologic.com/c/c12c1adc-3ff0-4d32-b95c-c593135c903e",
"status": "CREATED",
"result": {
"enquiry": {
"status": "IN_PROGRESS",
"formId": "c1655381-b8c9-4598-b861-a6c4ac805504"
}
}
}
In the above response we got the following information:
id- the conversation id. We will need it when inquiring about its status.userKey- ID of the user which data you will gather, exactly what you entered when creating the conversation.url- the address to which the user should be redirected in order to verify the identity.status- conversation status.CREATEDmarks a new conversation where the user has not yet started the verification process.result- conversation result. At the moment we do not have any data, so there appears, within the product for which we asked the status:IN_PROGRESSand the form identifier (formId)
Enquiry Form Display
The form data is gathered by sending the user to the address returned in the url field.
So now open your browser and go to the page you got in this parameter. You should see the screen with
the defined form.
After going through the process, you should be redirected to the returnUrl page that you entered when creating the conversation.
Getting Conversation Result
Now let's check the conversation status. You should get request on url that was provided in callbackUrl field during
creating conversation.
{
"id": "74b58e66-22c9-40c5-9af1-7ab0efa11753",
"created": "2025-01-07T09:03:45.559584+01:00",
"target": "CONVERSATION",
"event": "FINISHED",
"payload": {
"conversation": {
"id": "c12c1adc-3ff0-4d32-b95c-c593135c903e",
"userKey": "7dfb9ded-c38f-49ae-95e2-307283a0b1f6",
"url": "https://sandbox.authologic.com/c/c12c1adc-3ff0-4d32-b95c-c593135c903e",
"status": "FINISHED",
"result": {
"enquiry": {
"status": "FINISHED",
"formId": "c1655381-b8c9-4598-b861-a6c4ac805504",
"formData": {
"email": "john.doe@doe.com",
"residence": "Real Avenue 9",
"termsAcceptance": "true"
}
}
}
}
}
}
Conversation Identifier vs Callback Identifier
Please note, that in the above response the top level identifier is the callback identifier, not the conversation identifier. In order to retrieve metadata about the conversation using Authologic APIs, you should use the conversation identifier, which is the id field value that is located in the payload.conversation object.
This time the status has changed to FINISHED, which means the process is complete. At the same time, the result
structure also contains the FINISHED state, which means that all the data was successfully determined. Retrieved
data appeared in the user structure.