Platform capabilities
The default platform is
BEYOND_AI. LEARNWITH_AI applies a destination-specific event transformation before submission. Changing only the base URL does not prove that the selected paths or payload schema match another API. The Partner Events API at /events/1.0 has a separate contract.
Installation
Send an activity
Run credentialed client code on a trusted backend. These examples explicitly select the legacy contract and supply synthetic identities. Replace them with assigned user, course, and app values.Build once, retry the same event
sendActivity and sendTimeSpent create a fresh event ID and timestamp when you omit them. Calling a convenience method again without preserving those fields can create a distinct event.
For durable delivery, build the event once using createActivityEvent or createTimeSpentEvent, retain the event payload, and send it with client.events.send(sensor, events). The Python factories are create_activity_event and create_time_spent_event. Preserve the original event and metric collection identities across transport retries.
Do not edit a submitted payload and reuse its event ID as a replacement operation. The legacy event store retains the first content for an external ID. Use your integration’s correction procedure.
Methods
Validation, queries, and polling require a configured path for that operation. The send result’s
jobId/job_id can be absent. The batch API’s compatibility value "0" is not a job to poll.
Job monitoring
For a legacy job, polling stops when queue state iscompleted, and raises for failed or timeout. It does not inspect every semantic error in the worker result. Inspect returnValue in TypeScript or return_value in Python, including any error or partial-result information.
A completed queue job does not prove that all webhook subscribers or downstream analytics succeeded. Verify the expected persisted result separately.
Historical queries
Legacy event listing supports limit, offset, sensor, actor ID, actor email, start date, and end date. For example:Generic and question events
events.send accepts event objects, but the server still enforces its selected schema. Support for an event in one platform does not guarantee support in another, and schema acceptance does not itself award XP.
The client also provides question-seen, question-answered, and question-graded factories. Their destination-specific shapes should be checked against the assigned contract before use. Use the Partner Event Reference or Platform Event Reference for those APIs.
Error handling
The current package does not export anApiError class. Handle failures using the errors provided by your installed client version. A portable error boundary can inspect error instanceof Error for a message; avoid logging access tokens or raw student event payloads.
Correct validation and authorization failures before retrying. For ambiguous network or server failures, retain event identity and use bounded retries. Confirm the resulting activity through the destination’s supported read APIs.