Browse SDKs · WASM
Platform
SDKsWASM

Create a location message

Create a location message with the WASM SDK.

Copy

Parameters

ParameterTypeRequiredDescription
descriptionstringYesLocation name or address description.
longitudenumberYesLongitude.
latitudenumberYesLatitude.
const { data: message } = await openimsdk.createLocationMessage({
  description: 'Pudong, Shanghai',
  longitude: 121.4737,
  latitude: 31.2304,
});

The coordinates come from a location result obtained by the application or a location selected by the user. The sender and receiver should use the same coordinate system to avoid offsets between map providers. The SDK does not obtain location data or correct coordinates. When the Promise resolves, it returns only a pending message object.