Erstellen einer Applikation

In diesem Codeschnipsel sehen Sie, wie Sie eine Application erstellen.

Beispiel

Sie müssen sicherstellen, dass die folgenden ersetzbaren Werte im Beispielcode mit einer geeigneten Methode gesetzt werden:

SchlüsselBeschreibung
VONAGE_API_KEY

Your Vonage API key (see it on your dashboard).

VONAGE_API_SECRET

Your Vonage API secret (also available on your dashboard).

Schreiben Sie den Code

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

curl -X "POST" "https://api.nexmo.com/v2/applications" \
     -H 'Content-Type: application/json' \
     -u "$VONAGE_API_KEY:$VONAGE_API_SECRET" \
     -d $'{
  "name": "Code Snippets V2 Application",
  "capabilities": {
    "messages": {
      "webhooks": {
        "inbound_url": {
          "address": "https://example.com/webhooks/inbound",
          "http_method": "POST"
        },
        "status_url": {
          "address": "https://example.com/webhooks/status",
          "http_method": "POST"
        }
      }
    },
    "voice": {
      "webhooks": {
        "answer_url": {
          "address": "https://example.com/webhooks/answer",
          "http_method": "GET"
        },
        "fallback_answer_url": {
          "address": "https://fallback.example.com/webhooks/answer",
          "http_method": "GET"
        },
        "event_url": {
          "address": "https://example.com/webhooks/event",
          "http_method": "POST"
        }
      }
    },
    "rtc": {
      "webhooks": {
        "event_url": {
          "address": "https://example.com/webhooks/event",
          "http_method": "POST"
        }
      }
    },
    "vbc": {},
    "verify": {
      "webhooks": {

Vollständige Quelle anzeigen

Führen Sie Ihren Code aus

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

./create-application.sh