mv.events
The event log behind webhooks. These methods are on mv.events, where mv is your client (see the Node.js SDK). Each one returns the response object and throws when the API answers with an error.
list()
Section titled “list()”List events. Events in this mode, newest first, for the last 30 days. Filter by type (type=call.*, or several with types[]) and creation time (created[gte]…).
mv.events.list(query?: NonNullable<EventsListData["query"]>, options?: RequestOptions): PagedList<EventsListResponse["data"][number], NonNullable<EventsListData["query"]>>GET /events · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
query.limit |
integer |
no | How many objects to return, 1–100 (default 20). |
query.starting_after |
string |
no | A cursor (next_cursor) or object ID: return the objects after it (older). |
query.ending_before |
string |
no | A cursor or object ID: return the objects before it (newer). |
query.type |
string |
no | Only events of this type. An event type (call.ended), a group (call.*) or "*" for every event. |
query.types |
array |
no | Only events of these types (types[]=call.ended&types[]=qa.*). |
query.created |
object |
no | Filter on the creation time: created[gte], created[gt], created[lte], created[lt] (ISO-8601). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”A PagedList: await it for the first page, for await it for every item.
Example
Section titled “Example”import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({ client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),});
for await (const event of mv.events.list()) { console.log(event);}retrieve()
Section titled “retrieve()”Retrieve an event.
mv.events.retrieve(id: EventsRetrieveData["path"]["id"], options?: RequestOptions): Promise<EventsRetrieveResponse>GET /events/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A event ID (evt_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”Event:
| Field | Type | Description |
|---|---|---|
id |
string |
The event ID (also the webhook-id header of its deliveries). |
object |
"event" |
Always event. |
type |
"call.created" | "call.started" | "call.ringing" | "call.answered" | "call.transferred" | "call.ended" | "call.analyzed" | "call.cost_finalized" | … |
— |
created |
string |
An ISO-8601 timestamp in UTC. |
api_version |
string |
— |
livemode |
boolean |
true in live mode, false in test mode. |
org_id |
string |
A org ID (prefix org_). |
data |
object |
— |
request |
object |
— |
Example
Section titled “Example”import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({ client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),});
const event = await mv.events.retrieve("evt_jNaQaYnevVGeozxIzDr3fN");console.log(event);