/users/{userId}/targetsAlcance users.writeSDK: solo @owbase/node
Create a messaging target.
Parámetros
Sección titulada «Parámetros»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.
Respuestas
Sección titulada «Respuestas»201Éxito400Parámetro inválido o faltante401Sin sesión, sin permiso en el recurso o clave sin el alcance404Recurso de la ruta no encontrado429Límite de peticionesTodo 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});curl -X POST "https://cloud.owbase.dev/v1/users/<USER_ID>/targets" \ -H "X-Owbase-Project: <PROJECT_ID>" \ -H "X-Owbase-Key: $OWBASE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"targetId":"<TARGET_ID>","providerType":"email","identifier":"<IDENTIFIER>"}'{ "$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.