External Accounts API

The External Accounts API is used to manage accounts for Viber Business Messages, Facebook Messenger and Whatsapp for use in the Messages and Dispatch APIs.

Télécharger la spécification OpenAPI

Application

Inbound messages to an external account which is linked to an application will be delivered to the application's inbound URL.

Link application to an account

posthttps://api.nexmo.com/beta/chatapp-accounts/:provider/:external_id/applications

Authentification

Cette API prend en charge l'authentification JWT et l'authentification de base. L'authentification de base est plus facile à mettre en œuvre, mais elle ne prend pas en charge les fonctions avancées telles que les listes de contrôle d'accès.

Vous pouvez utiliser l'authentification JWT ou l'authentification de base, mais pas les deux en même temps.

CléDescriptionExemple
Authorization

Votre jeton web JSON.
En savoir plus sur les JWT

Headers

Bearer <JWT>
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Trajectoire Paramètres

provider
string
Exigée

Provider of the account you want to assign an application to

Il doit s'agir de l'un d'entre eux :messengerviber_service_msgwhatsapprcs
external_id
string
Exigée

External id of the account you want to assign an application to. This is channel dependent. For Facebook it will be your Facebook Page ID, for Viber your Viber Service Message ID and for WhatsApp your WhatsApp number, for RCS it will be the RCS Agent ID.

Corps de la demande
Type de contenu
application/json

application
string
Exigée
exemple78d335fa-323d-0114-9c3d-d6f0d48968cf

There is just one application allowed per an account. The application type must be type "messages". For more information please see Application API Spec

Exemple Demande

{
   "application": "78d335fa-323d-0114-9c3d-d6f0d48968cf"
}

Réponses
Type de contenu
application/json

OK.

name
string
exemplename

The account name

applications
array

The array of associated application ids

external_id
string
Exigée
exemple12345678

The external identifier for this account

api_key
string
Exigée
exempleabcd1234

The external api key for this account

provider
string
Exigée
exemplemessenger

The provider (will be one of messenger, viber_service_msg, whatsapp, rcs).

Il doit s'agir de l'un d'entre eux :messengerviber_service_msgwhatsapprcs
access_token
string
exempleaccessToken

The provider access token (only for messenger)

Exemple Réponse

{
   "name": "name",
   "applications": [
      "78d335fa-323d-0114-9c3d-d6f0d48968cf"
   ],
   "external_id": "12345678",
   "api_key": "abcd1234",
   "provider": "messenger",
   "access_token": "accessToken"
}

Unlink application from an account

deletehttps://api.nexmo.com/beta/chatapp-accounts/:provider/:external_id/applications/:application_id

Authentification

Cette API prend en charge l'authentification JWT et l'authentification de base. L'authentification de base est plus facile à mettre en œuvre, mais elle ne prend pas en charge les fonctions avancées telles que les listes de contrôle d'accès.

Vous pouvez utiliser l'authentification JWT ou l'authentification de base, mais pas les deux en même temps.

CléDescriptionExemple
Authorization

Votre jeton web JSON.
En savoir plus sur les JWT

Headers

Bearer <JWT>
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Trajectoire Paramètres

provider
string
Exigée

Provider of the account you want to unlink an application from

Il doit s'agir de l'un d'entre eux :messengerviber_service_msgwhatsapprcs
external_id
string
Exigée

External id of the account you want to unlink an application from

application_id
string
Exigée

Id of the application you want to unlink

Réponses

No Content.

Account

An external-account used as the from field in the Messages API and Dispatch API

Opérations disponibles

Retrieve all accounts you own

gethttps://api.nexmo.com/beta/chatapp-accounts/

Authentification

Cette API prend en charge l'authentification JWT et l'authentification de base. L'authentification de base est plus facile à mettre en œuvre, mais elle ne prend pas en charge les fonctions avancées telles que les listes de contrôle d'accès.

Vous pouvez utiliser l'authentification JWT ou l'authentification de base, mais pas les deux en même temps.

CléDescriptionExemple
Authorization

Votre jeton web JSON.
En savoir plus sur les JWT

Headers

Bearer <JWT>
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Demande de renseignements Paramètres

provider
string

Filter by provider

Il doit s'agir de l'un d'entre eux :messengerviber_service_msgwhatsapp
page_number
integer
Défaut1
exemple1

Page number of the results

page_size
integer
Défaut20
exemple1

Page size of the results

Réponses
Type de contenu
application/json

OK.

page_number
integer
exemple1
page_size
integer
exemple10
_embedded
array
name
string
exempleoptionalName

The account name

applications
array

The array of associated application ids

external_id
string
Exigée
exemple12345678

The external identifier for this account

api_key
string
Exigée
exempleabcd1234

The external api key for this account

provider
string
Exigée
exemple[ "messenger", "viber_service_msg", "whatsapp" ]

The provider (will be messenger).

access_token
string
Exigée
exemplemyAccessToken

The provider access token

_links
object
self
object
href
string
exemplehttps://api.nexmo.com/beta/chatapp-accounts?page_number=1&page_size=10
next
object
href
string
exemplehttps://api.nexmo.com/beta/chatapp-accounts?page_number=3&page_size=10
prev
object
href
string
exemplehttps://api.nexmo.com/beta/chatapp-accounts?page_number=1&page_size=10
first
object
href
string
exemplehttps://api.nexmo.com/beta/chatapp-accounts?page_number=1&page_size=10
last
object
href
string
exemplehttps://api.nexmo.com/beta/chatapp-accounts?page_number=4&page_size=10

Exemple Réponse

{
   "page_number": 1,
   "page_size": 10,
   "_embedded": [
      {
         "name": "optionalName",
         "applications": [
            "optionalApplicationId"
         ],
         "external_id": "12345678",
         "api_key": "abcd1234",
         "provider": "whatsapp",
         "access_token": "myAccessToken"
      }
   ],
   "_links": {
      "self": {
         "href": "https://api.nexmo.com/beta/chatapp-accounts?page_number=1&page_size=10"
      },
      "next": {
         "href": "https://api.nexmo.com/beta/chatapp-accounts?page_number=3&page_size=10"
      },
      "prev": {
         "href": "https://api.nexmo.com/beta/chatapp-accounts?page_number=1&page_size=10"
      },
      "first": {
         "href": "https://api.nexmo.com/beta/chatapp-accounts?page_number=1&page_size=10"
      },
      "last": {
         "href": "https://api.nexmo.com/beta/chatapp-accounts?page_number=4&page_size=10"
      }
   }
}

Facebook Messenger

Managing your Facebook Messenger account

Create a Messenger account

posthttps://api.nexmo.com/beta/chatapp-accounts/messenger

Authentification

Cette API prend en charge l'authentification JWT et l'authentification de base. L'authentification de base est plus facile à mettre en œuvre, mais elle ne prend pas en charge les fonctions avancées telles que les listes de contrôle d'accès.

Vous pouvez utiliser l'authentification JWT ou l'authentification de base, mais pas les deux en même temps.

CléDescriptionExemple
Authorization

Votre jeton web JSON.
En savoir plus sur les JWT

Headers

Bearer <JWT>
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Corps de la demande
Type de contenu
application/json

external_id
string
Exigée
exemple12345678

This is the unique identifier within the provider's domain. In this case it is the Page ID for your Facebook Page. Go to your Facebook Page, click "Settings", click "Messenger platform " scroll down to "Messenger link" to find your Page ID.

access_token
string
Exigée
exemplemyAccessToken

This is the Facebook Business Page token. You can obtain the token using one of the following methods:

name
string
exempleoptionalName

Custom account name

applications
array

Contains a list of application IDs which are linked to the account.

  • There is just one application allowed per an account.
  • The application type must be type "messages".
For more information see Application API spec

Exemple Demande

{
   "external_id": "12345678",
   "access_token": "myAccessToken",
   "name": "optionalName",
   "applications": [
      "78d335fa-323d-0114-9c3d-d6f0d48968cf"
   ]
}

Réponses
Type de contenu
application/json

Created.

name
string
exempleoptionalName

The account name

applications
array

The array of associated application ids

external_id
string
Exigée
exemple12345678

The external identifier for this account

api_key
string
Exigée
exempleabcd1234

The external api key for this account

provider
string
Exigée
exemplemessenger

The provider (will be messenger).

access_token
string
Exigée
exemplemyAccessToken

The provider access token

Exemple Réponse

{
   "name": "optionalName",
   "applications": [
      "78d335fa-323d-0114-9c3d-d6f0d48968cf"
   ],
   "external_id": "12345678",
   "api_key": "abcd1234",
   "provider": "messenger",
   "access_token": "myAccessToken"
}

Retrieve a Messenger account

gethttps://api.nexmo.com/beta/chatapp-accounts/messenger/:external_id

Authentification

Cette API prend en charge l'authentification JWT et l'authentification de base. L'authentification de base est plus facile à mettre en œuvre, mais elle ne prend pas en charge les fonctions avancées telles que les listes de contrôle d'accès.

Vous pouvez utiliser l'authentification JWT ou l'authentification de base, mais pas les deux en même temps.

CléDescriptionExemple
Authorization

Votre jeton web JSON.
En savoir plus sur les JWT

Headers

Bearer <JWT>
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Trajectoire Paramètres

external_id
string
Exigée

External id of the account you want to retrieve. In this case it is the Facebook Page ID.

Réponses
Type de contenu
application/json

OK.

name
string
exempleoptionalName

The account name

applications
array

The array of associated application ids

external_id
string
Exigée
exemple12345678

The external identifier for this account

api_key
string
Exigée
exempleabcd1234

The external api key for this account

provider
string
Exigée
exemplemessenger

The provider (will be messenger).

access_token
string
Exigée
exemplemyAccessToken

The provider access token

Exemple Réponse

{
   "name": "optionalName",
   "applications": [
      "78d335fa-323d-0114-9c3d-d6f0d48968cf"
   ],
   "external_id": "12345678",
   "api_key": "abcd1234",
   "provider": "messenger",
   "access_token": "myAccessToken"
}

Update a Messenger account

patchhttps://api.nexmo.com/beta/chatapp-accounts/messenger/:external_id

Authentification

Cette API prend en charge l'authentification JWT et l'authentification de base. L'authentification de base est plus facile à mettre en œuvre, mais elle ne prend pas en charge les fonctions avancées telles que les listes de contrôle d'accès.

Vous pouvez utiliser l'authentification JWT ou l'authentification de base, mais pas les deux en même temps.

CléDescriptionExemple
Authorization

Votre jeton web JSON.
En savoir plus sur les JWT

Headers

Bearer <JWT>
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Trajectoire Paramètres

external_id
string
Exigée

External id of the account you want to update. In this case it is the Facebook Page ID.

Corps de la demande
Type de contenu
application/json

name
string
exemplenewName

The new account name

applications
array
access_token
string
exempleupdatedAccessToken

Exemple Demande

{
   "name": "newName",
   "applications": [
      "78d335fa-323d-0114-9c3d-d6f0d48968cf"
   ],
   "access_token": "updatedAccessToken"
}

Réponses
Type de contenu
application/json

OK.

name
string
exemplenewName

The account name

applications
array

The array of associated application ids

external_id
string
Exigée
exemple12345678

The external identifier for this account. In this case it is the Facebook Page ID.

api_key
string
Exigée
exempleabcd1234

The external api key for this account

provider
string
Exigée
exemplemessenger

The provider (will be messenger).

access_token
string
Exigée
exempleupdatedAccessToken

The provider access token

Exemple Réponse

{
   "name": "newName",
   "applications": [
      "78d335fa-323d-0114-9c3d-d6f0d48968cf"
   ],
   "external_id": "12345678",
   "api_key": "abcd1234",
   "provider": "messenger",
   "access_token": "updatedAccessToken"
}

Delete a Messenger account

deletehttps://api.nexmo.com/beta/chatapp-accounts/messenger/:external_id

Authentification

Cette API prend en charge l'authentification JWT et l'authentification de base. L'authentification de base est plus facile à mettre en œuvre, mais elle ne prend pas en charge les fonctions avancées telles que les listes de contrôle d'accès.

Vous pouvez utiliser l'authentification JWT ou l'authentification de base, mais pas les deux en même temps.

CléDescriptionExemple
Authorization

Votre jeton web JSON.
En savoir plus sur les JWT

Headers

Bearer <JWT>
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Trajectoire Paramètres

external_id
string
Exigée

External id of the account you want to delete. In this case it is the Facebook Page ID.

Réponses

No Content.

Viber Service Message

Managing your Viber Service Message account

Retrieve a Viber Service Message account

gethttps://api.nexmo.com/beta/chatapp-accounts/viber_service_msg/:external_id

Authentification

Cette API prend en charge l'authentification JWT et l'authentification de base. L'authentification de base est plus facile à mettre en œuvre, mais elle ne prend pas en charge les fonctions avancées telles que les listes de contrôle d'accès.

Vous pouvez utiliser l'authentification JWT ou l'authentification de base, mais pas les deux en même temps.

CléDescriptionExemple
Authorization

Votre jeton web JSON.
En savoir plus sur les JWT

Headers

Bearer <JWT>
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Trajectoire Paramètres

external_id
string
Exigée

External id of the account you want to retrieve. In this case it will be your Viber Service Message ID.

Réponses
Type de contenu
application/json

OK.

name
string
exempleoptionalName

The account name

applications
array

The array of associated application ids

external_id
string
Exigée
exemple12345678

The external identifier for this account

api_key
string
Exigée
exempleabcd1234

The external api key for this account

provider
string
Exigée
exempleviber_service_msg

The provider (will be viber_service_msg).

Exemple Réponse

{
   "name": "optionalName",
   "applications": [
      "78d335fa-323d-0114-9c3d-d6f0d48968cf"
   ],
   "external_id": "12345678",
   "api_key": "abcd1234",
   "provider": "viber_service_msg"
}

Whatsapp

Managing your Whatsapp account

Opérations disponibles

Retrieve a Whatsapp account

gethttps://api.nexmo.com/beta/chatapp-accounts/whatsapp/:external_id

Authentification

Cette API prend en charge l'authentification JWT et l'authentification de base. L'authentification de base est plus facile à mettre en œuvre, mais elle ne prend pas en charge les fonctions avancées telles que les listes de contrôle d'accès.

Vous pouvez utiliser l'authentification JWT ou l'authentification de base, mais pas les deux en même temps.

CléDescriptionExemple
Authorization

Votre jeton web JSON.
En savoir plus sur les JWT

Headers

Bearer <JWT>
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Trajectoire Paramètres

external_id
string
Exigée

External id of the account you want to retrieve. In this case it will be the WhatsApp number.

Réponses
Type de contenu
application/json

OK.

name
string
exempleoptionalName

The account name

applications
array

The array of associated application ids

external_id
string
Exigée
exemple12345678

The external identifier for this account

api_key
string
Exigée
exempleabcd1234

The external api key for this account

provider
string
Exigée
exemplewhatsapp

The provider (will be whatsapp).

Exemple Réponse

{
   "name": "optionalName",
   "applications": [
      "optionalApplicationId"
   ],
   "external_id": "12345678",
   "api_key": "abcd1234",
   "provider": "whatsapp"
}