-
Notifications
You must be signed in to change notification settings - Fork 181
Vonage Audit
Documentation / Vonage Audit
Audit Events are generated automatically by Vonage as the user interacts with either a Vonage API or the Vonage Dashboard. Each Audit Event object has a type and associated metadata.
The list of supported event types does change from time to time. For this reason the OPTIONS method is provided to return event types. You can see how to return the definitive list of event types from the https://developer.vonage.com/en/audit/code-snippets/get-event-types
Documentation https://developer.vonage.com/en/audit/concepts/audit-events
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
ACCOUNT_SECRET_CREATE |
"ACCOUNT_SECRET_CREATE" |
Secret Rotation operation. | audit/lib/enums.ts:63 |
ACCOUNT_SECRET_DELETE |
"ACCOUNT_SECRET_DELETE" |
Secret Rotation operation. | audit/lib/enums.ts:58 |
ACCOUNT_UPDATE_SETTINGS_API |
"ACCOUNT_UPDATE_SETTINGS_API" |
Account Settings updated via API. | audit/lib/enums.ts:73 |
ACCOUNT_UPDATE_SPAMMER |
"ACCOUNT_UPDATE_SPAMMER" |
Account Settings updated via API. | audit/lib/enums.ts:68 |
APP_CREATE |
"APP_CREATE" |
App created. | audit/lib/enums.ts:103 |
APP_DELETE |
"APP_DELETE" |
App deleted. | audit/lib/enums.ts:113 |
APP_DISABLE |
"APP_DISABLE" |
App disabled. | audit/lib/enums.ts:118 |
APP_ENABLE |
"APP_ENABLE" |
App enabled. | audit/lib/enums.ts:123 |
APP_UPDATE |
"APP_UPDATE" |
App updated. | audit/lib/enums.ts:108 |
AUTORELOAD_DISABLE |
"AUTORELOAD_DISABLE" |
Automatic reload disabled. | audit/lib/enums.ts:148 |
AUTORELOAD_ENABLE |
"AUTORELOAD_ENABLE" |
Automatic reload enabled. | audit/lib/enums.ts:138 |
AUTORELOAD_UPDATE |
"AUTORELOAD_UPDATE" |
Automatic reload settings updated. | audit/lib/enums.ts:143 |
IP_WHITELIST_CREATE |
"IP_WHITELIST_CREATE" |
Whitelist IP added. | audit/lib/enums.ts:128 |
IP_WHITELIST_DELETE |
"IP_WHITELIST_DELETE" |
Whitelist IP deleted. | audit/lib/enums.ts:133 |
NUMBER_ASSIGN |
"NUMBER_ASSIGN" |
Number assigned. | audit/lib/enums.ts:78 |
NUMBER_LINKED |
"NUMBER_LINKED" |
Number linked to Vonage application. | audit/lib/enums.ts:93 |
NUMBER_RELEASE |
"NUMBER_RELEASE" |
Number released. | audit/lib/enums.ts:88 |
NUMBER_UNLINKED |
"NUMBER_UNLINKED" |
Number unlinked from Vonage application. | audit/lib/enums.ts:98 |
NUMBER_UPDATED |
"NUMBER_UPDATED" |
Number updated. | audit/lib/enums.ts:83 |
USER_API_KEYS_UPDATE |
"USER_API_KEYS_UPDATE" |
Sub-accounts for user updated. | audit/lib/enums.ts:53 |
USER_BILLING_UPDATE |
"USER_BILLING_UPDATE" |
User billing updated. | audit/lib/enums.ts:28 |
USER_CREATE |
"USER_CREATE" |
User created. | audit/lib/enums.ts:33 |
USER_LOGIN |
"USER_LOGIN" |
User login (Premium Support only). | audit/lib/enums.ts:38 |
USER_LOGOUT |
"USER_LOGOUT" |
User logout (Premium Support only). | audit/lib/enums.ts:43 |
USER_PRODUCT_SEARCH |
"USER_PRODUCT_SEARCH" |
Relates to searching for CDRs or logs in Dashboard. | audit/lib/enums.ts:48 |
USER_STATUS |
"USER_STATUS" |
User status updated. | audit/lib/enums.ts:18 |
USER_UPDATE |
"USER_UPDATE" |
User updated. | audit/lib/enums.ts:23 |
Represents an SDK client for interacting with audit-related functionality.
This client is only available as a standalone client. It cannot be instantiated from a Vonage client.
Create a standalone Audit client
import { Audit } from '@vonage/audit';
const auditClient = new Audit({
apiKey: VONAGE_API_KEY,
apiSecret: VONAGE_API_SECRET
});
new Audit(credentials, options?): Audit
Creates a new instance of the Client.
The authentication credentials or an authentication instance.
Optional configuration settings for the client.
server-client/dist/lib/client.d.ts:35
protected auth: AuthInterface;
The authentication instance responsible for generating authentication headers and query parameters.
server-client/dist/lib/client.d.ts:24
authType: AuthenticationType = AuthenticationType.BASIC;
The type of authentication used for the client's requests.
protected BASE_PATH: string = 'beta';
protected config: ConfigParams;
Configuration settings for the client, including default hosts for various services and other request settings.
server-client/dist/lib/client.d.ts:28
static transformers: object;
Static property containing utility transformers.
camelCaseObjectKeys: PartialTransformFunction;
kebabCaseObjectKeys: PartialTransformFunction;
omit: (keys, obj) => TransformedObject;
string
[]
snakeCaseObjectKeys: PartialTransformFunction;
server-client/dist/lib/client.d.ts:11
addAuthenticationToRequest(request): Promise<VetchOptions>
Adds the appropriate authentication headers or parameters to the request based on the authentication type.
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addAuthenticationToRequest
server-client/dist/lib/client.d.ts:43
protected addBasicAuthToRequest(request): Promise<VetchOptions>
Adds basic authentication headers to the request.
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
server-client/dist/lib/client.d.ts:71
protected addJWTToRequest(request): Promise<VetchOptions>
Adds a JWT to the request.
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
server-client/dist/lib/client.d.ts:64
protected addQueryKeySecretToRequest(request): Promise<VetchOptions>
Adds API key and secret to the request.
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addQueryKeySecretToRequest
server-client/dist/lib/client.d.ts:57
protected addQueryKeySecretToRequestBody(request): Promise<VetchOptions>
Adds API key and secret to the request body.
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addQueryKeySecretToRequestBody
server-client/dist/lib/client.d.ts:50
getConfig(): ConfigParams
server-client/dist/lib/client.d.ts:36
getEvent(eventId): Promise<AuditEvent>
Retrieves a specific audit event by its ID.
string
The ID of the audit event to retrieve.
Promise
<AuditEvent
>
A promise that resolves to the retrieved audit event.
Retrieve a specific audit event
const auditEvent = await auditClient.getEvent('event-id');
console.log(auditEvent.id);
getEvents(params): AsyncGenerator<AuditEvent, void, undefined>
Retrieves a list of audit events based on specified parameters.
The query parameters for filtering audit events.
AsyncGenerator
<AuditEvent
, void
, undefined
>
An async generator that yields audit events.
Retrieve a list of audit events
const auditEvents = auditClient.getEvents({
page: 1,
size: 10,
dateFrom: '2021-01-01T00:00:00Z',
dateTo: '2021-01-31T23:59:59Z',
eventType: 'message',
search: 'search term'
});
for await (const event of auditEvents) {
console.log(event.id);
console.log(event.type);
console.log(event.created);
console.log(event.accountId);
console.log(event.requestId);
console.log(event.request);
console.log(event.response);
console.log(event.ipAddress);
console.log(event.country);
console.log(event.msisdn);
}
protected parseResponse<T>(request, response): Promise<VetchResponse<T>>
Parses the response based on its content type.
• T
The expected type of the parsed response data.
The request options.
Response
The raw response from the request.
Promise
<VetchResponse
<T
>>
- The parsed response.
server-client/dist/lib/client.d.ts:168
protected prepareBody(request): undefined | string
Prepares the body for the request based on the content type.
The request options.
undefined
| string
- The prepared request body as a string or undefined.
server-client/dist/lib/client.d.ts:158
protected prepareRequest(request): Promise<VetchOptions>
Prepares the request with necessary headers, authentication, and query parameters.
The initial request options.
Promise
<VetchOptions
>
- The modified request options.
server-client/dist/lib/client.d.ts:151
sendDeleteRequest<T>(url): Promise<VetchResponse<T>>
Sends a DELETE request to the specified URL.
• T
string
The URL endpoint for the DELETE request.
Promise
<VetchResponse
<T
>>
- The response from the DELETE request.
server-client/dist/lib/client.d.ts:78
sendFormSubmitRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a POST request with form data to the specified URL.
• T
string
The URL endpoint for the POST request.
Record
<string
, undefined
| string
>
Optional payload containing form data to send with the POST request.
Promise
<VetchResponse
<T
>>
- The response from the POST request.
server-client/dist/lib/client.d.ts:86
sendGetRequest<T>(url, queryParams?): Promise<VetchResponse<T>>
Sends a GET request to the specified URL with optional query parameters.
• T
string
The URL endpoint for the GET request.
Optional query parameters to append to the URL. These should be compatible with Node's URLSearchParams.
Promise
<VetchResponse
<T
>>
- The response from the GET request.
server-client/dist/lib/client.d.ts:94
sendPatchRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a PATCH request to the specified URL with an optional payload.
• T
string
The URL endpoint for the PATCH request.
Optional payload to be sent as the body of the PATCH request.
Promise
<VetchResponse
<T
>>
- The response from the PATCH request.
server-client/dist/lib/client.d.ts:104
sendPostRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a POST request to the specified URL with an optional payload.
• T
string
The URL endpoint for the POST request.
Optional payload to be sent as the body of the POST request.
Promise
<VetchResponse
<T
>>
- The response from the POST request.
server-client/dist/lib/client.d.ts:114
sendPutRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a PUT request to the specified URL with an optional payload.
• T
string
The URL endpoint for the PUT request.
Optional payload to be sent as the body of the PUT request.
Promise
<VetchResponse
<T
>>
- The response from the PUT request.
server-client/dist/lib/client.d.ts:124
sendRequest<T>(request): Promise<VetchResponse<T>>
Sends a request adding necessary headers, handling authentication, and parsing the response.
• T
The options defining the request, including URL, method, headers, and data.
Promise
<VetchResponse
<T
>>
- The parsed response from the request.
server-client/dist/lib/client.d.ts:144
sendRequestWithData<T>(
method,
url,
payload?): Promise<VetchResponse<T>>
Sends a request with JSON-encoded data to the specified URL using the provided HTTP method.
• T
The HTTP method to be used for the request (only POST, PATCH, or PUT are acceptable).
POST
| PUT
| PATCH
string
The URL endpoint for the request.
Optional payload to be sent as the body of the request, JSON-encoded.
Promise
<VetchResponse
<T
>>
- The response from the request.
server-client/dist/lib/client.d.ts:135
type AuditEvent: object;
Represents an Audit Event.
accountId: string;
The API_KEY of the Vonage API account that the audit event is associated with.
optional context: unknown;
Additional context information for the audit event.
createdAt: string;
The date when the audit event was created.
eventType: AuditEventTypes | string;
The type of the audit event.
id: string;
UUID of the audit event.
source: "CD" | "DEVAPI";
The source of the event.
sourceCountry: string;
ISO 3166-1 Alpha-2 country code recorded for the event.
sourceDescription: "Customer Dashboard" | "Developer API";
Description of the audit event source.
optional userEmail: string;
Email of the user whose account the audit event is associated with.
optional userId: string;
The ID of the user that the audit event is associated with.
audit/lib/types/auditEvent.ts:5
type AuditEventListResponse: object;
Represents the response containing a list of audit events.
optional _embedded: object;
An object containing an array of audit events.
_embedded.events: AuditEvent[];
_links: APILinks;
Links associated with the API response.
page: AuditEventPage;
Information about the pagination and page details.
Vonage API's will return information using snake_case
. This represents the
pure response before the client will transform the keys into camelCase
audit/lib/types/auditEventListResponse.ts:12
type AuditEventPage: object;
Represents information about the pagination of audit events.
number: number;
The current page number.
size: number;
The number of items per page.
totalElements: number;
The total number of elements across all pages.
totalPages: number;
The total number of pages available.
audit/lib/types/auditEventPage.ts:4
type AuditEventResponse: object & Pick<AuditEvent, "id" | "source" | "context">;
Represents an Audit Event.
account_id: string;
The API_KEY of the Vonage API account that the audit event is associated with.
created_at: string;
The date when the audit event was created.
event_type: AuditEventTypes | string;
The type of the audit event.
source_country: string;
ISO 3166-1 Alpha-2 country code recorded for the event.
source_description: Pick<AuditEvent, "sourceDescription">;
Description of the audit event source.
optional user_email: string;
Email of the user whose account the audit event is associated with.
optional user_id: string;
The ID of the user that the audit event is associated with.
Vonage API's will return information using snake_case
. This represents the
pure response before the client will transform the keys into camelCase
audit/lib/types/auditEventResponse.ts:11
type AuditParams: object;
Represents parameters for querying audit events.
optional dateFrom: string;
The start date for the audit event query.
optional dateTo: string;
The end date for the audit event query.
optional eventType: AuditEventTypes | string;
The type of the audit event to filter by.
optional page: number;
The page number for paginated results.
optional searchText: string;
Text to search within audit event descriptions.
optional size: number;
The number of items per page.
audit/lib/types/auditParams.ts:6
type AuditResponse<T>: VetchResponse<T>;
• T
this is not used