Crear un evento

En este fragmento de código aprenderás a crear un Evento.

Product deprecation notice

Effective April 30th, 2026, Vonage In-App Messaging will no longer be available. Access for new users will be closed, and the service will be discontinued for all existing users.

If you have any questions regarding this product’s discontinuation, please contact your account manager or our support team.

Ejemplo

Asegúrese de que las siguientes variables se ajustan a los valores requeridos utilizando cualquier método conveniente:

ClaveDescripción
CONVERSATION_ID

The ID of the Conversation.

MEMBER_ID

The unique ID of the Member.

Requisitos previos

You will need to use an existing Application that contains a Conversation in order to be able to create an Event. See the Create Conversation code snippet for information on how to create an Application and some sample Conversations.

Escriba el código

Añada lo siguiente a create-event.sh:

curl -X "POST" "https://api.nexmo.com/v1/conversations/$CONV_ID/events" \
     -H 'Authorization: Bearer '$JWT\
     -H 'Content-Type: application/json' \
     -d $'{
  "type": "'$CONV_EVENT_TYPE'",
  "from": "'$CONV_EVENT_FROM'"
  "body": {
      "message_type": "text",
      "text": "string"
   }
}'

Ver fuente completa

Ejecute su código

Guarde este archivo en su máquina y ejecútelo:

bash create-event.sh

Pruébalo

Al ejecutar el código se creará un nuevo Evento.