Ir al contenido
v2.7

Crear destino del usuario

Create a messaging target.

POST/users/{userId}/targetsAlcance users.write

SDK: solo @owbase/node

Create a messaging target.

userId string obligatorio

User ID.

targetId string obligatorio

Target ID. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can’t start with a special char. Max length is 36 chars.

providerType MessagingProviderType obligatorio

The target provider type. Can be one of the following: email, sms or push. Valores: email, sms, push.

identifier string obligatorio

The target identifier (token, email, phone etc.)

providerId string

Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.

name string

Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.

Acceso: clave de API con el alcance users.write.

201Éxito
400Parámetro inválido o faltante
401Sin sesión, sin permiso en el recurso o clave sin el alcance
404Recurso de la ruta no encontrado
429Límite de peticiones

Todo error llega como JSON con code, type y message: consulta Errores.

import { Client, Users, MessagingProviderType } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const users = new Users(client);
const result = await users.createTarget({
userId: '<USER_ID>',
targetId: '<TARGET_ID>',
providerType: MessagingProviderType.Email,
identifier: '<IDENTIFIER>',
providerId: '<PROVIDER_ID>', // optional
name: '<NAME>', // optional
});
Respuesta201 Created
{
"$id": "259125845563242502",
"$createdAt": "2020-10-15T06:38:00.000+00:00",
"$updatedAt": "2020-10-15T06:38:00.000+00:00",
"name": "Apple iPhone 12",
"userId": "259125845563242502",
"providerId": "259125845563242502",
"providerType": "email",
"identifier": "token",
"expired": false
}

Las descripciones de esta página vienen de la especificación de la API del servidor (licencia BSD-3-Clause), en inglés, y los ejemplos vienen del generador de SDKs (licencia MIT). Los avisos completos están en el archivo NOTICE de los paquetes @owbase/web y @owbase/node.

¿Te ayudó esta página?