In this tutorial, you will learn how to set up Next Matter and Twilio to use the One-Time-Password SMS Verification. Only takes 5 minutes.

Step 1: Create your Twilio API Key

Step 2: Activate Twilio Verify Service

Step 3: Configure the Next Matter Integration

  1. Create the Verification process (if not previously created).

  2. Setup the Verification process.

  3. Add the Verification process trigger in the main process.

  4. Setup the Verification trigger steps.

Step 1: Create your Twilio API Key

You can either use your Account SID and Auth Token to authenticate (see image) or you can create a dedicated API Key for managing access.

To create a dedicated API Key please go to Twilio > Account > API keys & tokens.

In both cases, please copy your Account SID and Auth Token into a bas64 encoder in the following format:

Account SID:Auth Token

This will generate your API Key.


Step 2: Activate Twilio Verify Service

Sign in to Twilio as an administrator and Navigate to "Explore Products" in the left-hand side. There you will find the "Verify" product under the "Account security" section. Please activate it.

Once the Verify product is activated, please go to "Verify>Services". A list of existing services will be displayed and a blue plus icon to create a new one. Please create a new Verify Service. This service will have a "Service SID".

Save the Service SID as this is an important parameter to use in your Next Matter setup.


Step 3: Configure the Next Matter Integration

The OTP SMS Verification requires two processes. One is the process you want to integrate with Twilio, let's call it "Main process". The other one is a helper process that actually does the verification - the "Verification process". The main process triggers the Verification process. The verification logic is outside of the main process.

NOTE: The Verification process can be used by more than one process. There is no need to create one verification process each time. 

The steps we will follow are the following:

  1. Create the Verification process (if not previously created).

  2. Setup the Verification process.

  3. Add the Verification process trigger in the main process.

  4. Setup the Verification trigger steps.

1. Create the Verification process

Create a new process. Add the Step template "OTP Verification Process (1/2)".

2. Setup the Verification process

The following steps shall be configured:

  • Step "4. Send Text" and "10. Verify Code". These steps make a request to the Twilio Verify API. Please set up the following details:

    • Twilio Verify Service SID: Please fill the request URL placeholder <TWILIO_VERIFY_SERVICE_SID>.

    • Twilio API Key: Please replace the placeholder <TWILIO_API_KEY> in the Authorization header.

  • Steps 5 and 11. "Complete Result Step". These steps complete the next step. It fills the result obtained from the Twilio request. Please update the following details:

    • Next step id: Replace in the request body the placeholder <STEP_ID> with the step Id of the next step (steps 6 and 12). You can take the step id by navigating to this step and taking the last number of the URL (https://app.nextmatter.com/app/editor/edit/<PROCESS>/step/<STEP_ID>).

    • Next step action ids: Replace in the request body the placeholders <ACTION_ID1>, <ACTION_ID2> and <ACTION_ID3> by the action ids of the next step. In the order of appearance. To get the action ID, please click on the ID icon on top of each input.

    • Next Matter API Key: Please fill it in the placeholder <API Key> in the Authorization header.

Request Body of Step 5

Show Results Step Ids

3. Add the Verification trigger in the main process

Select the Next Matter process that should integrate with Twilio, open the editor and add the Step Template called "OTP Verification Trigger Process (2/2)".

4. Setup the Verification trigger steps

The step "Launch OTP SMS Verification" triggers the Next Matter Verification process. Please fill in:

  • Next Matter API Key: Use it to replace <API Key> in the Authorization header.

  • Verification Process Id: Use it to replace the placeholder <VERIFICATION_PROCESS_ID> in the body request.

The step "Send details to Verification" inputs the personal details to perform the Verification and where to get the verification result (whether it has been successful or not). Please fill in the following details:

  • Next Matter API Key: Use it to replace the placeholder <API Key> in the Authorization header.

  • Result step id: This is the id of the next step where the result is shown. Use it to replace <RESULT_STEP_ID> in the body request.

  • Result action id: This is the id of the radio action where the result is shown. Use it to replace <RESULT_ACTION_ID> in the body request.

Did this answer your question?