Skip to content

Latest commit

 

History

History
69 lines (50 loc) · 2.1 KB

events-how-to.md

File metadata and controls

69 lines (50 loc) · 2.1 KB
title topic type
Listen for events
events
how-to

How to listen for Events

Overview

The event API allows you to subscribe to a variety of different events generated by Working Group Two's systems.

The examples will start a subscription to voice and voicemail events, which includes call initiated, call ended and new voicemail received.

Required rights
Event type Required right
VOICE_EVENT events.voice.subscribe
VOICEMAIL_EVENT events.voicemail.subscribe
LOCATION_UPDATE_EVENT events.location.subscribe
ROAMING_EVENT events.roaming.subscribe
TOKEN_AUDIT_EVENT events.audit.token.subscribe

Your rights can be configured in Console

grpcurl

Setup streaming of events, without manual acknowledgment:

grpcurl \
  -H "Authorization: Basic ${OPERATOR_TOKEN}"\
  -import-path . \
  -proto wgtwo/events/v0/events.proto \
  -d '
  {
    "type": ["VOICE_EVENT"]
  }
  ' \
  api.wgtwo.com:443 \
  wgtwo.events.v0.EventsService.Subscribe

Java / Kotlin

Install dependencies

Then you can add event-grpc and utils-grpc:

Listen for events

Manual acknowledge

In the below example we enable manual acknowledgement, and setting a custom ack timeout.

Include Google's Protocol Buffers utility library for support of Google's Well-Known Types:

Concepts