Créer un agent

Ce point d'accès permet de créer un agent à l'aide de l'API du gestionnaire de canaux. Il enregistre un agent pour une marque donnée, notamment en fournissant des actifs de marque (logo, bannière), des informations d'affichage, un numéro de téléphone, une description, etc.

Exemple

Vous trouverez ci-dessous la description de toutes les variables utilisées dans chaque extrait de code :

CléDescription
VONAGE_API_KEY

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

VONAGE_API_SECRET

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

VONAGE_APPLICATION_ID

The Vonage Application ID.

CHANNEL_MANAGER_RCS_AGENT_DISPLAY_NAME

The unique display name of the RCS Agent.

CHANNEL_MANAGER_RCS_AGENT_SENDER_ID

A unique sender identifier for the RCS Agent on the Vonage platform.

CHANNEL_MANAGER_RCS_AGENT_HOSTING_REGION

The geographic location where your RCS business messaging service will be hosted and operated.

CHANNEL_MANAGER_RCS_AGENT_PURPOSE

Specifies the intended use of the RCS Agent.

CHANNEL_MANAGER_RCS_AGENT_BILLING_CATEGORY

Specifies the pricing model applied to messages sent via this RCS Agent.

CHANNEL_MANAGER_RCS_BRAND_ID

The ID of the RCS brand.

CHANNEL_MANAGER_RCS_AGENT_TAGLINE

A short phrase that represents the RCS Agent.

CHANNEL_MANAGER_RCS_AGENT_BRAND_COLOR

The hexadecimal color code for the primary color used in UI elements.

CHANNEL_MANAGER_RCS_AGENT_PHONE_NUMBER

End-user contact number in E.164 format.

CHANNEL_MANAGER_RCS_AGENT_EMAIL_ADDRESS

The contact email address for the RCS Agent.

CHANNEL_MANAGER_RCS_AGENT_WEBSITE_ADDRESS

The website address for the RCS Agent.

Conditions préalables

Si vous n'avez pas de demande, vous pouvez créer un. Veillez également à configurer vos webhooks.

Rédiger le code

Ajouter ce qui suit à create-agent.sh:

curl -X POST https://api.nexmo.com/v1/channel-manager/rcs/agents \
  -u "${VONAGE_API_KEY}:${VONAGE_API_SECRET}" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d $'{
  "basic_info": {
    "display_name": "'${CHANNEL_MANAGER_RCS_AGENT_DISPLAY_NAME}'",
    "sender_id": "'${CHANNEL_MANAGER_RCS_AGENT_SENDER_ID}'",
    "hosting_region": "'${CHANNEL_MANAGER_RCS_AGENT_HOSTING_REGION}'",
    "agent_purpose": "'${CHANNEL_MANAGER_RCS_AGENT_PURPOSE}'",
    "billing_category": "'${CHANNEL_MANAGER_RCS_AGENT_BILLING_CATEGORY}'",
    "brand_id": "'${CHANNEL_MANAGER_RCS_BRAND_ID}'"
  },
  "visual_design": {
    "tagline": "'${CHANNEL_MANAGER_RCS_AGENT_TAGLINE}'",
    "brand_color": "'${CHANNEL_MANAGER_RCS_AGENT_BRAND_COLOR}'",
    "phone": [
      {
        "number": "'${CHANNEL_MANAGER_RCS_AGENT_PHONE_NUMBER}'"
      }
    ],
    "email": [
      {
        "address": "'${CHANNEL_MANAGER_RCS_AGENT_EMAIL_ADDRESS}'"
      }
    ],
    "website": [
      {
        "url": "'${CHANNEL_MANAGER_RCS_AGENT_WEBSITE_ADDRESS}'"
      }
    ]
  },
  "application_settings": {
    "application_id": "'${VONAGE_APPLICATION_ID}'"
  }
}'

Voir la source complète

Exécutez votre code

Enregistrez ce fichier sur votre machine et exécutez-le :

bash create-agent.sh