Twilio Segment Demo Integration

This document outlines a possible example of how to integrate SheerID into a Twilio Segment project.


This is a lightweight demo showcasing the ease of using SheerID verification data as a Twilio Segment data source. This demo is not meant to give a feature-complete solution integrating SheerID verification into an existing Twilio Segment project, but to give ideas on how to approach the task and raise questions.

Ways to integrate with SheerID

There are at least three scenarios:

  • Give code to the consumer on success / Send code to the consumer via email.
  • Apply code to shopping session (visible or invisible).
  • Send verified signal to the merchant and use the verified status freely.

The demo is implementing the third scenario. The first scenario is the easiest to implement, but the consumer needs to enter the code manually.

The second scenario is the most complex to implement from the frontend perspective, but the consumer does not need to enter the code manually.

The third scenario is giving the most freedom, as it can be used to implement integration with any third-party systems and there is no limitation on how the verified customer data can be utilized, stored and reused.

Demo Application

The demo is a simple node.js-based Express server, accepting requests from the webhooks from SheerID verification API.

The demo application’s code is publicly available on the SheerID github:


Endpoints used in the current demo:

  • /api/success-webhook endpoint receiving SheerID verification webhook.


The demo application is using SheerID API and webhooks. The demo is using a SheerID program in test mode, so no real verification is done, but the verification process is fully functional. See more about how to test your program here.


Running this example requires:


Preparation, this process does not install anything outside of the cloned folder.

  • Clone the repository to your local machine.
  • Run npm install to install the dependencies.

Running the Application

How to use:

  • Create a data source in your Twilio Segment workspace. Make note of the write key for the source.
    • The data source does not need a destination, the debugger can be used to track events.
  • Log in to your MySheerID Dashboard
    • Create a SheerID program, that you will use e.g. “Student discount”.
    • Configure your program with eligibility, theme etc.
    • Set the Codes section to “No Code”.
    • In Program Settings:
      • Set Webhook for eligible verification to https://<your_server_address>/api/success-webhook.
      • Add userId as a required Metadata Tracking Field. See this page for more information about tracking custom metadata.
    • Copy the access token from Settings > Access Tokens page.
  • Copy .env.example to a new .env file, and add relevant information about your setup, for example:
    WRITE_KEY=<Your Twilio Segment Write Key>
    SHEERID_TOKEN=<Your Copied SheerID Access Token>
  • Run npm start to run the application.