Actualizar un miembro

En este fragmento de código aprenderás a actualizar los detalles de un Miembro. Para eliminar un Miembro de la Conversación, cambie el parámetro state a left.

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.

USER_ID

The unique ID of the User.

MEMBER_ID

The unique ID of the Member.

Requisitos previos

You will need to use an existing Application that contains a Conversation and at least one Member in order to be able to update a Member. 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 update-member.sh:

curl -X "PUT" "https://api.nexmo.com/v1/conversations/$CONV_ID/members/$CONV_MEMBER_ID" \
     -H 'Authorization: Bearer '$JWT\
     -H 'Content-Type: application/json' \
     -d $'{
  "state": "'$CONV_MEMBER_STATE'",
  "from": "string"
}'

Ver fuente completa

Ejecute su código

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

bash update-member.sh

Pruébalo

Al ejecutar el código se actualizará el diputado.