Ein Ereignis erstellen

In diesem Codeschnipsel erfahren Sie, wie Sie ein Ereignis erstellen.

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.

Beispiel

Stellen Sie sicher, dass die folgenden Variablen mit einer beliebigen Methode auf die gewünschten Werte gesetzt werden:

SchlüsselBeschreibung
CONVERSATION_ID

The ID of the Conversation.

MEMBER_ID

The unique ID of the Member.

Voraussetzungen

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.

Schreiben Sie den Code

Fügen Sie Folgendes zu create-event.sh hinzu:

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"
   }
}'

Vollständige Quelle anzeigen

Führen Sie Ihren Code aus

Speichern Sie diese Datei auf Ihrem Rechner und führen Sie sie aus:

bash create-event.sh

Probieren Sie es aus

Wenn Sie den Code ausführen, erstellen Sie ein neues Ereignis.