3. Get delivery events for OTP

You can query the events endpoint of an otp delivery instance to get back a list of events reported for this delivery.

Basic example of getting events for OTP delivery:

curl \
-X GET \
-H "apikey: yourApiKey" \
https://api.tyntec.com/2fa/v1/otp/b3eaee2c-c3c4-4f40-87e5-c21d07905b27/events

* b3eaee2c-c3c4-4f40-87e5-c21d07905b27 is the uuid of the generated OTP request for this example.

Response to Basic Example for getting OTP status (JSON) 

HTTP/1.1 200 OK

[ { type: 'INITIAL_OTP_REQ',
    created: 1502699988995,
    timestampCreated: '2017-08-14T08:39:48.995Z' },
  { type: 'OTP_VERIFY_OK',
    created: 1502700284084,
    timestampCreated: '2017-08-14T08:44:44.084Z' },
  { statusText: 'delivered',
    type: 'OTP_SMS_RES',
    smsCode: '0000',
    created: 1502699992946,
    timestampCreated: '2017-08-14T08:39:52.946Z' },
  { status: 'success',
    type: 'DELIVER_OTP_RES_OK',
    created: 1502699989105,
    timestampCreated: '2017-08-14T08:39:49.105Z' } ]

Event entity

Field Description
status

possible values:

success/failed/null

statusText The status reported by the deivery system
type Refere to the next table regarding all event types
sipCode In case of voice delivery the sip return code will be listed here
smsCode In case of sms delivery the sms return code will be listed here
created Epoch time
timestampCreated Timestamp in string format UTC

 Event Types

 

Event type Description Example
INITIAL_OTP_REQ Marks the initial OTP request made as API call { type: 'INITIAL_OTP_REQ',
created: 1502699988995,
timestampCreated: '2017-08-14T08:39:48.995Z' }
DELIVER_OTP_RES_OK Marks the successful result for delivery towards the channel { status: 'success',
type: 'DELIVER_OTP_RES_OK',
created: 1502699989105,
timestampCreated: '2017-08-14T08:39:49.105Z' }
DELIVER_OTP_RES_FAIL Marks the failed result for delivery towards the channel { status: 'failed',
type: 'DELIVER_OTP_RES_FAIL',
created: 1502699989105,
timestampCreated: '2017-08-14T08:39:49.105Z' }
RESEND_OTP_RES_OK Marks the successful result for delivery towards the channel for an OTP resend { status: 'success',
type: 'RESEND_OTP_RES_OK',
created: 1502699989105,
timestampCreated: '2017-08-14T08:39:49.105Z' }
RESEND_OTP_RES_FAIL Marks the failed result for delivery towards the channel for an OTP resend { status: 'failed',
type: 'RESEND_OTP_RES_FAIL',
created: 1502699989105,
timestampCreated: '2017-08-14T08:39:49.105Z' }
OTP_SMS_RES Marks the delivery report coming for a sms delivery { statusText: 'delivered',
type: 'OTP_SMS_RES',
smsCode: '0000',
created: 1502699992946,
timestampCreated: '2017-08-14T08:39:52.946Z' }
OTP_VOICE_RES Marks the delivery report coming for a voice call delivery { statusText: 'ok',
type: 'OTP_VOICE_RES',
created: 1502700988376,
timestampCreated: '2017-08-14T08:56:28.376Z' }
OTP_VERIFY_FAIL Marks the event when there was a failed attempt to verify an OTP code { type: 'OTP_VERIFY_FAIL',
created: 1502700284084,
timestampCreated: '2017-08-14T08:44:44.084Z' }
OTP_VERIFY_OK Marks the event when there was a successful attempt to verify an OTP code { type: 'OTP_VERIFY_OK',
created: 1502700284084,
timestampCreated: '2017-08-14T08:44:44.084Z' }