mv.testHelpersEvents
Simulate calls and events in test mode. These methods are on mv.testHelpersEvents, 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.
create()
Section titled “create()”Send a sample event. Test mode only. Emits one sample event of type: it is stored and delivered to your test-mode webhook endpoints that subscribe to it, signed and retried like any event.
mv.testHelpersEvents.create(body: TestHelpersEventsCreateData["body"], options?: RequestOptions): Promise<TestHelpersEventsCreateResponse>POST /test_helpers/events · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
body.type |
string |
yes | An event type from the catalogue, e.g. call.ended. |
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.headers["Idempotency-Key"] |
string |
no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”TestHelperEvent:
| Field | Type | Description |
|---|---|---|
object |
"test_event" |
Always test_event. |
id |
string |
The event’s ID: it is stored and delivered like any event. |
type |
string |
— |
livemode |
boolean |
true in live mode, false in test mode. |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const testHelperEvent = await mv.testHelpersEvents.create({ type: "call.ended",});console.log(testHelperEvent);