Available Operations Errors
 
 

Messages API

Beta

The Messaging API is a new API that consolidates all messaging channels. It encapsulates a user (developer) from having to use multiple APIs to interact with our various channels such as SMS, MMS, Viber, Facebook Messenger, etc. The API normalises information across all channels to abstracted to, from and content. This API is currently in Beta.

Available Operations:

Send a Message

Send a Message over SMS, WhatsApp, Viber, Facebook Messenger, or MMS

POST https://api.nexmo.com/v0.1/messages
Host https://api.nexmo.com
POST /v0.1/messages

Authentication

This API supports both JWT and Basic authentication. Basic authentication is easier to get started with, but does not support advanced features such as ACLs.

You can use either JWT or Basic authentication, but not both at the same time.

Key Description Example Default
Authorization Your JSON web token.
Read more about JWTs
Bearer <JWT> None
Authorization Base64 encoded API key and secret joined by a colon.
Read more
Basic <base64> None

Request body application/json

Send a Message.

to
object | Required
type
string | Required

The channel the message is going to.

Must be one of: sms
number
string | Required

The phone number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

The channel the message is coming from

Must be one of: sms
number
string | Required

The Vonage Virtual number the message is originating from in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

message
object | Required
content
object | Required
type
string | Required

The content type of the message

Must be one of: text
text
string | Required

Limited to 1000 characters. The Messages API automatically detects unicode characters when sending SMS and sends the message as a unicode SMS. For more information on how concatenation and encoding please visit: developer.nexmo.com/messaging/sms/guides/concatenation-and-encoding.

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

Channel the message is going to

Must be one of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

Must be one of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required

Content of the whatsapp message

type
string | Required

The type of message that you are sending

Must be one of: text
text
string | Required | Min: 1 | Max: 4096

Text Message limited to 4096 characters, including unicode.

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

Channel the message is going to

Must be one of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

Must be one of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required
type
string | Required

the type of message that you are sending

Must be one of: template
template
object | Required

The Template request object to be sent to WhatsApp.

name
string | Required

The name of the template. For WhatsApp use your WhatsApp namespace (available via Facebook Business Manager), followed by a colon : and the name of the template to use.

parameters
array of strings

The parameters are an array. The first value being {{1}} in the template.

whatsapp
object | Required
locale
string | Required

The BCP 47 language of the template. Vonage will translate the BCP 47 format to the WhatsApp equivalent. For examples en-GB will be auto-translate to en_GB.

policy
string

Policy for resolving what language template to use. Please note that WhatsApp deprecated the fallback policy in January of 2020, all requests carrying a fallback policy will be rejected with a 400 error

Must be one of: deterministic
client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

Channel the message is going to

Must be one of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

Must be one of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required
type
string | Required

The type of message that you are sending

Must be one of: image
image
object | Required

image content object

url
string (url) | Required

The publicly accessible URL of the image attachment. The image file is available for 48 hours after it is created. Supported types are .jpg, .jpeg, and .png

caption
string

Additional text to accompany the image.

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

Channel the message is going to

Must be one of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

Must be one of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required
type
string | Required

The type of message that you are sending

Must be one of: video
video
object | Required

the video content object for the WhatsApp request

url
string (url) | Required

Publicly accessible URL of the video attachment. Supports file types .mp4 and .3gpp

Note: Only supports video codec H.264 and audio codec AAC

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

Channel the message is going to

Must be one of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

Must be one of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required
type
string | Required

the type of message that you are sending

Must be one of: audio
audio
object | Required

The audio content object for the request

url
string (url) | Required

The publicly accessible URL of the audio attachment. The audio file is available for 48 hours after it is created. Supports .aac, .m4a, .amr, .mp3 and .opus

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

Channel the message is going to

Must be one of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

Must be one of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required
type
string | Required

The type of message that you are sending.

Must be one of: file
file
object | Required

The file content object to be sent.

url
string (url) | Required

The publicly accessible URL of the file to be sent. Supports .pdf, .doc(x), .ppt(x), and .xls(x)

caption

Additional text to accompany the file.

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

The channel you are sending to

Must be one of: viber_service_msg
number
string | Required

The Viber number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

The channel your message will be coming from.

Must be one of: viber_service_msg
id
string | Required

This is your Service Message ID given to you by Nexmo Account Manager. To find out more please visit nexmo.com/products/messages.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent

Must be one of: text
text
string | Required | Max: 1000

Text to be sent to the user, limited to 1000 characters, including unicode.

viber_service_msg
object
category
string

The use of different category tags enables the business to send messages for different use cases. For Viber Service Messages the first message sent from a business to a user must be personal, informative & a targeted message - not promotional. By default Nexmo sends the transaction category to Viber Service Messages.

Must be one of: transaction or promotion
ttl
integer | Min: 30 | Max: 259200

Set the time-to-live of message to be delivered in seconds. i.e. if the message is not delivered in 600 seconds then delete the message.

type
string

Viber-specific type definition. To use "template", please contact Nexmo Account Manager to setup your templates. To find out more please visit nexmo.com/products/messages.

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

The channel you are sending to

Must be one of: viber_service_msg
number
string | Required

The Viber number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

The channel your message will be coming from.

Must be one of: viber_service_msg
id
string | Required

This is your Service Message ID given to you by Nexmo Account Manager. To find out more please visit nexmo.com/products/messages.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent

Must be one of: image
image
object | Required

Image content to be sent

url
string (url) | Required

Publicly accessible URL of the image to be attached. The image file is available for 48 hours after it's created. Supports .jpg, .jpeg, and .png.

viber_service_msg
object
category
string

The use of different category tags enables the business to send messages for different use cases. For Viber Service Messages the first message sent from a business to a user must be personal, informative & a targeted message - not promotional. By default Nexmo sends the transaction category to Viber Service Messages.

Must be one of: transaction or promotion
ttl
integer | Min: 30 | Max: 259200

Set the time-to-live of message to be delivered in seconds. i.e. if the message is not delivered in 600 seconds then delete the message.

type
string

Viber-specific type definition. To use "template", please contact Nexmo Account Manager to setup your templates. To find out more please visit nexmo.com/products/messages.

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

The channel you are sending to

Must be one of: viber_service_msg
number
string | Required

The Viber number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

The channel your message will be coming from.

Must be one of: viber_service_msg
id
string | Required

This is your Service Message ID given to you by Nexmo Account Manager. To find out more please visit nexmo.com/products/messages.

message
object | Required
content
object | Required
type
string | Required

The type of message you are sending

Must be one of: template
template
object | Required

The template to be sent.

name
string | Required

The name of the template to be sent

parameters
array of strings

The parameters are an array. The first value being {{1}} in the template.

viber_service_msg
object
category
string

The use of different category tags enables the business to send messages for different use cases. For Viber Service Messages the first message sent from a business to a user must be personal, informative & a targeted message - not promotional. By default Nexmo sends the transaction category to Viber Service Messages.

Must be one of: transaction or promotion
ttl
integer | Min: 30 | Max: 259200

Set the time-to-live of message to be delivered in seconds. i.e. if the message is not delivered in 600 seconds then delete the message.

type
string

Viber-specific type definition. To use "template", please contact Nexmo Account Manager to setup your templates. To find out more please visit nexmo.com/products/messages.

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

The channel that you are sending to

Must be one of: messenger
id
string | Required

The ID of the Message recipient. This value should be the from.id value you receive on an inbound message from messenger

from
object | Required
type
string | Required

The channel that you are sending from

Must be one of: messenger
id
string | Required

This value should be the to.id value you received in the inbound messenger event. Can also be found using your account dashboard when trying to link external accounts to your applications.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent.

Must be one of: text
text
string | Required

The text to be sent to the recipient's Facebook Messenger account.

messenger
object
category
string

The use of different category tags enables the business to send messages for different use cases. For Facebook Messenger they need to comply with their Messaging Types policy. Nexmo maps our category to their messaging_type. If message_tag is used, then an additional tag for that type is mandatory. By default Nexmo sends the response category to Facebook Messenger.

Must be one of: response, update or message_tag
tag
string

A full list of the possible tags is available on developers.facebook.com

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

The channel that you are sending to

Must be one of: messenger
id
string | Required

The ID of the Message recipient. This value should be the from.id value you receive on an inbound message from messenger

from
object | Required
type
string | Required

The channel that you are sending from

Must be one of: messenger
id
string | Required

This value should be the to.id value you received in the inbound messenger event. Can also be found using your account dashboard when trying to link external accounts to your applications.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent.

Must be one of: image
image
object | Required

The image content being sent to the recipient.

url
string (url) | Required

The URL of the image attachment. The image file is available for 48 hours after it is created. Supported types are .jpg, .jpeg, .png, and .gif

messenger
object
category
string

The use of different category tags enables the business to send messages for different use cases. For Facebook Messenger they need to comply with their Messaging Types policy. Nexmo maps our category to their messaging_type. If message_tag is used, then an additional tag for that type is mandatory. By default Nexmo sends the response category to Facebook Messenger.

Must be one of: response, update or message_tag
tag
string

A full list of the possible tags is available on developers.facebook.com

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

The channel that you are sending to

Must be one of: messenger
id
string | Required

The ID of the Message recipient. This value should be the from.id value you receive on an inbound message from messenger

from
object | Required
type
string | Required

The channel that you are sending from

Must be one of: messenger
id
string | Required

This value should be the to.id value you received in the inbound messenger event. Can also be found using your account dashboard when trying to link external accounts to your applications.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent.

Must be one of: video
video
object | Required

The video content being sent to the recipient.

url
string (url) | Required

The URL of the video attachment. Supports .mp4.

messenger
object
category
string

The use of different category tags enables the business to send messages for different use cases. For Facebook Messenger they need to comply with their Messaging Types policy. Nexmo maps our category to their messaging_type. If message_tag is used, then an additional tag for that type is mandatory. By default Nexmo sends the response category to Facebook Messenger.

Must be one of: response, update or message_tag
tag
string

A full list of the possible tags is available on developers.facebook.com

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

The channel that you are sending to

Must be one of: messenger
id
string | Required

The ID of the Message recipient. This value should be the from.id value you receive on an inbound message from messenger

from
object | Required
type
string | Required

The channel that you are sending from

Must be one of: messenger
id
string | Required

This value should be the to.id value you received in the inbound messenger event. Can also be found using your account dashboard when trying to link external accounts to your applications.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent.

Must be one of: audio
audio
object | Required

The audio content being sent to the recipient.

url
string (url) | Required

The URL of the audio attachment. Supports .mp3.

messenger
object
category
string

The use of different category tags enables the business to send messages for different use cases. For Facebook Messenger they need to comply with their Messaging Types policy. Nexmo maps our category to their messaging_type. If message_tag is used, then an additional tag for that type is mandatory. By default Nexmo sends the response category to Facebook Messenger.

Must be one of: response, update or message_tag
tag
string

A full list of the possible tags is available on developers.facebook.com

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

The channel that you are sending to

Must be one of: messenger
id
string | Required

The ID of the Message recipient. This value should be the from.id value you receive on an inbound message from messenger

from
object | Required
type
string | Required

The channel that you are sending from

Must be one of: messenger
id
string | Required

This value should be the to.id value you received in the inbound messenger event. Can also be found using your account dashboard when trying to link external accounts to your applications.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent.

Must be one of: file
file
object | Required

The file content being sent to the recipient.

url
string (url) | Required

The URL of the file attachment. Supports .zip, .csv, and .pdf

messenger
object
category
string

The use of different category tags enables the business to send messages for different use cases. For Facebook Messenger they need to comply with their Messaging Types policy. Nexmo maps our category to their messaging_type. If message_tag is used, then an additional tag for that type is mandatory. By default Nexmo sends the response category to Facebook Messenger.

Must be one of: response, update or message_tag
tag
string

A full list of the possible tags is available on developers.facebook.com

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

to
object | Required
type
string | Required

The channel the message is going to

Must be one of: mms
number
string | Required

The phone number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

The channel the message is coming from

Must be one of: mms
number
string | Required

A US shortcode

message
object | Required
content
object | Required
type
string | Required

The type of message to be sent

Must be one of: image
image
object | Required
url
string (url) | Required

The URL of the image attachment. The image file is available for 48 hours after it is created. Supported file types are .jpg, .jpeg, .png, and .gif

client_ref
string

client reference up to 40 characters, the reference will be present in every message status

Responses

202 Accepted.
message_uuid
string

The UUID of the message.

Example Request » SMS

{
  "to": {
    "type": "sms",
    "number": "447700900000"
  },
  "from": {
    "type": "sms",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "text",
      "text": "Hello From Vonage!"
    }
  }
}
{
  "to": {
    "type": "sms",
    "number": "447700900000"
  },
  "from": {
    "type": "sms",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "text",
      "text": "Hello From Vonage!"
    }
  },
  "client_ref": "client-ref2"
}

Example Request » WhatsApp » Text

{
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "text",
      "text": "Hello From Vonage!"
    }
  }
}
{
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "text",
      "text": "Hello From Vonage!"
    }
  },
  "client_ref": "client-ref2"
}

Example Request » WhatsApp » Template

{
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "template",
      "template": {
        "name": "example_namespace':'verify"
      }
    },
    "whatsapp": {
      "locale": "en-GB"
    }
  }
}
{
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "template",
      "template": {
        "name": "example_namespace':'verify",
        "parameters": [
          "Daisy",
          "12345"
        ]
      }
    },
    "whatsapp": {
      "locale": "en-GB",
      "policy": "deterministic"
    }
  },
  "client_ref": "client-ref2"
}

Example Request » WhatsApp » Image

{
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "image",
      "image": {
        "url": "https://example.com/cat.jpg"
      }
    }
  }
}
{
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "image",
      "image": {
        "url": "https://example.com/cat.jpg",
        "caption": "My Tabby cat, Oliver."
      }
    }
  },
  "client_ref": "client-ref2"
}

Example Request » WhatsApp » Video

{
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "video",
      "video": {
        "url": "https://example.com/video.mp4"
      }
    }
  }
}
{
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "video",
      "video": {
        "url": "https://example.com/video.mp4"
      }
    }
  },
  "client_ref": "client-ref2"
}

Example Request » WhatsApp » Audio

{
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "audio",
      "audio": {
        "url": "https://example.com/audio.mp3"
      }
    }
  }
}
{
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "audio",
      "audio": {
        "url": "https://example.com/audio.mp3"
      }
    }
  },
  "client_ref": "client-ref2"
}

Example Request » WhatsApp » File

{
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "file",
      "file": {
        "url": "https://example.com/file.pdf"
      }
    }
  }
}
{
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "file",
      "file": {
        "url": "https://example.com/file.pdf",
        "caption": "An important report"
      }
    }
  },
  "client_ref": "client-ref2"
}

Example Request » Viber » Text

{
  "to": {
    "type": "viber_service_msg",
    "number": "447700900000"
  },
  "from": {
    "type": "viber_service_msg",
    "id": "654321"
  },
  "message": {
    "content": {
      "type": "text",
      "text": "Hello from Vonage!"
    }
  }
}
{
  "to": {
    "type": "viber_service_msg",
    "number": "447700900000"
  },
  "from": {
    "type": "viber_service_msg",
    "id": "654321"
  },
  "message": {
    "content": {
      "type": "text",
      "text": "Hello from Vonage!"
    },
    "viber_service_msg": {
      "category": "transaction",
      "ttl": 600,
      "type": "template"
    }
  },
  "client_ref": "client-ref2"
}

Example Request » Viber » Image

{
  "to": {
    "type": "viber_service_msg",
    "number": "447700900000"
  },
  "from": {
    "type": "viber_service_msg",
    "id": "654321"
  },
  "message": {
    "content": {
      "type": "image",
      "image": {
        "url": "https://example.com/image.jpg"
      }
    }
  }
}
{
  "to": {
    "type": "viber_service_msg",
    "number": "447700900000"
  },
  "from": {
    "type": "viber_service_msg",
    "id": "654321"
  },
  "message": {
    "content": {
      "type": "image",
      "image": {
        "url": "https://example.com/image.jpg"
      }
    },
    "viber_service_msg": {
      "category": "transaction",
      "ttl": 600,
      "type": "template"
    }
  },
  "client_ref": "client-ref2"
}

Example Request » Viber » Template

{
  "to": {
    "type": "viber_service_msg",
    "number": "447700900000"
  },
  "from": {
    "type": "viber_service_msg",
    "id": "654321"
  },
  "message": {
    "content": {
      "type": "template",
      "template": {
        "name": "verify"
      }
    }
  }
}
{
  "to": {
    "type": "viber_service_msg",
    "number": "447700900000"
  },
  "from": {
    "type": "viber_service_msg",
    "id": "654321"
  },
  "message": {
    "content": {
      "type": "template",
      "template": {
        "name": "verify",
        "parameters": [
          "Daisy",
          "12345"
        ]
      }
    },
    "viber_service_msg": {
      "category": "transaction",
      "ttl": 600,
      "type": "template"
    }
  },
  "client_ref": "client-ref2"
}

Example Request » Facebook Messenger » Text

{
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "text",
      "text": "Hello from Vonage!"
    }
  }
}
{
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "text",
      "text": "Hello from Vonage!"
    },
    "messenger": {
      "category": "update",
      "tag": "CONFIRMED_EVENT_UPDATE"
    }
  },
  "client_ref": "client-ref2"
}

Example Request » Facebook Messenger » Image

{
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "image",
      "image": {
        "url": "https://example.com/image.jpg"
      }
    }
  }
}
{
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "image",
      "image": {
        "url": "https://example.com/image.jpg"
      }
    },
    "messenger": {
      "category": "update",
      "tag": "CONFIRMED_EVENT_UPDATE"
    }
  },
  "client_ref": "client-ref2"
}

Example Request » Facebook Messenger » Video

{
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "video",
      "video": {
        "url": "https://example.com/video.mp4"
      }
    }
  }
}
{
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "video",
      "video": {
        "url": "https://example.com/video.mp4"
      }
    },
    "messenger": {
      "category": "update",
      "tag": "CONFIRMED_EVENT_UPDATE"
    }
  },
  "client_ref": "client-ref2"
}

Example Request » Facebook Messenger » Audio

{
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "audio",
      "audio": {
        "url": "https://example.com/audio.mp3"
      }
    }
  }
}
{
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "audio",
      "audio": {
        "url": "https://example.com/audio.mp3"
      }
    },
    "messenger": {
      "category": "update",
      "tag": "CONFIRMED_EVENT_UPDATE"
    }
  },
  "client_ref": "client-ref2"
}

Example Request » Facebook Messenger » File

{
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "file",
      "file": {
        "url": "https://example.com/file.zip"
      }
    }
  }
}
{
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "file",
      "file": {
        "url": "https://example.com/file.zip"
      }
    },
    "messenger": {
      "category": "update",
      "tag": "CONFIRMED_EVENT_UPDATE"
    }
  },
  "client_ref": "client-ref2"
}

Example Request » MMS

{
  "to": {
    "type": "mms",
    "number": "447700900000"
  },
  "from": {
    "type": "mms",
    "number": "12345"
  },
  "message": {
    "content": {
      "type": "image",
      "image": {
        "url": "https://example.com/image.jpg"
      }
    }
  }
}
{
  "to": {
    "type": "mms",
    "number": "447700900000"
  },
  "from": {
    "type": "mms",
    "number": "12345"
  },
  "message": {
    "content": {
      "type": "image",
      "image": {
        "url": "https://example.com/image.jpg"
      }
    }
  },
  "client_ref": "client-ref2"
}

Example Responses

202 400
{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
{
  "type": "https://www.nexmo.com/messages/Errors#InvalidParams",
  "title": "Invalid Parameters",
  "detail": "Your request parameters did not validate.",
  "instance": "f94b4e56604e07e5e5ad5a7228618f81"
}

Message Status Callback

Webhooks to inform about events happening to the message at communication level (has it been delivered, rejected by the provider...).

POST https://example.com/webhooks/message-status

Request body application/json

message_uuid
string | Required

The UUID of the message.

to
object | Required
type
string | Required

The type of message that you want to send.

One of: sms, viber_service_msg, messenger, whatsapp or mms
id
string | Min: 1 | Max: 50

Messenger: The ID of the message recipient. This value should be the from.id value you received in the inbound messenger event.

number
string | Min: 1 | Max: 50

SMS, Viber, WhatsApp or MMS: The phone number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

The type of message that you want to send.

One of: sms, viber_service_msg, messenger, whatsapp or mms
id
string | Min: 1 | Max: 50

Your ID for the platform that you are sending from.

Messenger: This value should be the to.id value you received in the inbound messenger event.

Viber: This is your Service Message ID given to you by Nexmo Account Manager. To find out more please visit nexmo.com/products/messages.

number
string | Min: 1 | Max: 50

SMS: The phone number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

WhatsApp: This is your WhatsApp Business Number given to you by Nexmo Account Manager. To find out more please visit nexmo.com/products/messages.

MMS: US shortcode

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

status
string | Required

The status of the message. The read message status is available for messenger, whatsapp and viber.

One of: submitted, delivered, read, rejected or undeliverable
error
object
code
integer

The error code. See our errors list for a list of possible errors

reason
string

Text describing the error. See our errors list for a list of possible errors

usage
object
currency
string

The charge currency in ISO 4217 format.

One of: EUR
price
string

The charge amount as a stringified number.

client_ref
string

The client's reference.

Example Payload

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "to": {
    "type": "sms"
  },
  "from": {
    "type": "sms"
  },
  "timestamp": "2020-01-01T14:00:00.000Z",
  "status": "delivered"
}
{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "to": {
    "type": "sms",
    "id": "0123456789012345",
    "number": "447700900000"
  },
  "from": {
    "type": "sms",
    "id": "0123456789012345",
    "number": "447700900000"
  },
  "timestamp": "2020-01-01T14:00:00.000Z",
  "status": "delivered",
  "error": {
    "code": 1300,
    "reason": "Not part of the provider network"
  },
  "usage": {
    "currency": "EUR",
    "price": "0.0333"
  },
  "client_ref": "my-personal-reference"
}

Inbound Message Callback

An inbound message from a customer to you.

POST https://example.com/webhooks/inbound-message

Request body application/json

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

Channel the message is going to

One of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

One of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required

Content of the whatsapp message

type
string | Required

The type of message that you are sending

One of: text
text
string | Required | Min: 1 | Max: 4096

Text Message limited to 4096 characters, including unicode.

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

Channel the message is going to

One of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

One of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required
type
string | Required

The type of message that you are sending

One of: image
image
object | Required

image content object

url
string (url) | Required

The publicly accessible URL of the image attachment. The image file is available for 48 hours after it is created. Supported types are .jpg, .jpeg, and .png

caption
string

Additional text to accompany the image.

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

Channel the message is going to

One of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

One of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required
type
string | Required

The type of message that you are sending

One of: video
video
object | Required

the video content object for the WhatsApp request

url
string (url) | Required

Publicly accessible URL of the video attachment. Supports file types .mp4 and .3gpp

Note: Only supports video codec H.264 and audio codec AAC

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

Channel the message is going to

One of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

One of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required
type
string | Required

the type of message that you are sending

One of: audio
audio
object | Required

The audio content object for the request

url
string (url) | Required

The publicly accessible URL of the audio attachment. The audio file is available for 48 hours after it is created. Supports .aac, .m4a, .amr, .mp3 and .opus

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

Channel the message is going to

One of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

One of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required
type
string | Required

The type of message that you are sending.

One of: file
file
object | Required

The file content object to be sent.

url
string (url) | Required

The publicly accessible URL of the file to be sent. Supports .pdf, .doc(x), .ppt(x), and .xls(x)

caption

Additional text to accompany the file.

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

Channel the message is going to

One of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

One of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required
type
string | Required

The type of message that you are sending

One of: location
location
object | Required

location content object

longitude
string | Required

The longitude of the location

latitude
string | Required

The latitude of the location

name
string

Name of the Location.

address
string

The address of the location, only displays if name is present

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

Channel the message is going to

One of: whatsapp
number
string | Required

The WhatsApp number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

Channel the message is going to be sent from.

One of: whatsapp
number
string | Required

WhatsApp Number the message is to be sent from.

message
object | Required
content
object | Required
type
string | Required

The type of message will be unsupported if a message is received is of an unsupported type

One of: unsupported
message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

The channel you are sending to

One of: viber_service_msg
id
string | Required

This is your Service Message ID given to you by Nexmo Account Manager. To find out more please visit nexmo.com/products/messages.

from
object | Required
type
string | Required

The channel your message will be coming from.

One of: viber_service_msg
number
string | Required

The Viber number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent

One of: text
text
string | Required | Max: 1000

Text to be sent to the user, limited to 1000 characters, including unicode.

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

The channel you are sending to

One of: viber_service_msg
id
string | Required

This is your Service Message ID given to you by Nexmo Account Manager. To find out more please visit nexmo.com/products/messages.

from
object | Required
type
string | Required

The channel your message will be coming from.

One of: viber_service_msg
number
string | Required

The Viber number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

message
object | Required
content
object | Required
type
string | Required

The type of message will be unsupported if a message is received is of an unsupported type

One of: unsupported
message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

The channel that you are sending to

One of: messenger
id
string | Required

The ID of the Message recipient. This value should be the from.id value you receive on an inbound message from messenger

from
object | Required
type
string | Required

The channel that you are sending from

One of: messenger
id
string | Required

This value should be the to.id value you received in the inbound messenger event. Can also be found using your account dashboard when trying to link external accounts to your applications.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent.

One of: text
text
string | Required

The text to be sent to the recipient's Facebook Messenger account.

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

The channel that you are sending to

One of: messenger
id
string | Required

The ID of the Message recipient. This value should be the from.id value you receive on an inbound message from messenger

from
object | Required
type
string | Required

The channel that you are sending from

One of: messenger
id
string | Required

This value should be the to.id value you received in the inbound messenger event. Can also be found using your account dashboard when trying to link external accounts to your applications.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent.

One of: image
image
object | Required

The image content being sent to the recipient.

url
string (url) | Required

The URL of the image attachment. The image file is available for 48 hours after it is created. Supported types are .jpg, .jpeg, .png, and .gif

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

The channel that you are sending to

One of: messenger
id
string | Required

The ID of the Message recipient. This value should be the from.id value you receive on an inbound message from messenger

from
object | Required
type
string | Required

The channel that you are sending from

One of: messenger
id
string | Required

This value should be the to.id value you received in the inbound messenger event. Can also be found using your account dashboard when trying to link external accounts to your applications.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent.

One of: video
video
object | Required

The video content being sent to the recipient.

url
string (url) | Required

The URL of the video attachment. Supports .mp4.

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

The channel that you are sending to

One of: messenger
id
string | Required

The ID of the Message recipient. This value should be the from.id value you receive on an inbound message from messenger

from
object | Required
type
string | Required

The channel that you are sending from

One of: messenger
id
string | Required

This value should be the to.id value you received in the inbound messenger event. Can also be found using your account dashboard when trying to link external accounts to your applications.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent.

One of: audio
audio
object | Required

The audio content being sent to the recipient.

url
string (url) | Required

The URL of the audio attachment. Supports .mp3.

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

The channel that you are sending to

One of: messenger
id
string | Required

The ID of the Message recipient. This value should be the from.id value you receive on an inbound message from messenger

from
object | Required
type
string | Required

The channel that you are sending from

One of: messenger
id
string | Required

This value should be the to.id value you received in the inbound messenger event. Can also be found using your account dashboard when trying to link external accounts to your applications.

message
object | Required
content
object | Required
type
string | Required

The type of message being sent.

One of: file
file
object | Required

The file content being sent to the recipient.

url
string (url) | Required

The URL of the file attachment. Supports .zip, .csv, and .pdf

message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

The channel that you are sending to

One of: messenger
id
string | Required

The ID of the Message recipient. This value should be the from.id value you receive on an inbound message from messenger

from
object | Required
type
string | Required

The channel that you are sending from

One of: messenger
id
string | Required

This value should be the to.id value you received in the inbound messenger event. Can also be found using your account dashboard when trying to link external accounts to your applications.

message
object | Required
content
object | Required
type
string | Required

The type of message will be unsupported if a message is received is of an unsupported type

One of: unsupported
message_uuid
string | Required

The UUID of the message.

timestamp
string (ISO 8601) | Required

The datetime of when the event occurred.

to
object | Required
type
string | Required

The channel the message is going to

One of: mms
number
string | Required

The phone number of the message recipient in the E.164 format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.

from
object | Required
type
string | Required

The channel the message is coming from

One of: mms
number
string | Required

A US shortcode

message
object | Required
content
object | Required
type
string | Required

The type of message to be sent

One of: image
image
object | Required
url
string (url) | Required

The URL of the image attachment. The image file is available for 48 hours after it is created. Supported file types are .jpg, .jpeg, .png, and .gif

Example Payload » WhatsApp » Text

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "text",
      "text": "Hello From Vonage!"
    }
  }
}

Example Payload » WhatsApp » Image

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "image",
      "image": {
        "url": "https://example.com/cat.jpg"
      }
    }
  }
}
{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "image",
      "image": {
        "url": "https://example.com/cat.jpg",
        "caption": "My Tabby cat, Oliver."
      }
    }
  }
}

Example Payload » WhatsApp » Video

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "video",
      "video": {
        "url": "https://example.com/video.mp4"
      }
    }
  }
}

Example Payload » WhatsApp » Audio

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "audio",
      "audio": {
        "url": "https://example.com/audio.mp3"
      }
    }
  }
}

Example Payload » WhatsApp » File

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "file",
      "file": {
        "url": "https://example.com/file.pdf"
      }
    }
  }
}
{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "file",
      "file": {
        "url": "https://example.com/file.pdf",
        "caption": "An important report"
      }
    }
  }
}

Example Payload » WhatsApp » Location

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "location",
      "location": {
        "longitude": "-122.425332",
        "latitude": "37.758056"
      }
    }
  }
}
{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "location",
      "location": {
        "longitude": "-122.425332",
        "latitude": "37.758056",
        "name": "Facebook HQ",
        "address": "1 Hacker Way, Menlo Park, CA 94025"
      }
    }
  }
}

Example Payload » WhatsApp » Unsupported

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "whatsapp",
    "number": "447700900000"
  },
  "from": {
    "type": "whatsapp",
    "number": "447700900001"
  },
  "message": {
    "content": {
      "type": "unsupported"
    }
  }
}

Example Payload » Viber » Text

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "viber_service_msg",
    "id": "654321"
  },
  "from": {
    "type": "viber_service_msg",
    "number": "447700900000"
  },
  "message": {
    "content": {
      "type": "text",
      "text": "Hello from Vonage!"
    }
  }
}

Example Payload » Viber » Unsupported

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "viber_service_msg",
    "id": "654321"
  },
  "from": {
    "type": "viber_service_msg",
    "number": "447700900000"
  },
  "message": {
    "content": {
      "type": "unsupported"
    }
  }
}

Example Payload » Facebook Messenger » Text

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "text",
      "text": "Hello from Vonage!"
    }
  }
}

Example Payload » Facebook Messenger » Image

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "image",
      "image": {
        "url": "https://example.com/image.jpg"
      }
    }
  }
}

Example Payload » Facebook Messenger » Video

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "video",
      "video": {
        "url": "https://example.com/video.mp4"
      }
    }
  }
}

Example Payload » Facebook Messenger » Audio

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "audio",
      "audio": {
        "url": "https://example.com/audio.mp3"
      }
    }
  }
}

Example Payload » Facebook Messenger » File

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "file",
      "file": {
        "url": "https://example.com/file.zip"
      }
    }
  }
}

Example Payload » Facebook Messenger » Unsupported

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "messenger",
    "id": "123456789987"
  },
  "from": {
    "type": "messenger",
    "id": "123456789987"
  },
  "message": {
    "content": {
      "type": "unsupported"
    }
  }
}

Example Payload » MMS

{
  "message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "timestamp": "2020-01-01T14:00:00.000Z",
  "to": {
    "type": "mms",
    "number": "447700900000"
  },
  "from": {
    "type": "mms",
    "number": "12345"
  },
  "message": {
    "content": {
      "type": "image",
      "image": {
        "url": "https://example.com/image.jpg"
      }
    }
  }
}

Errors

The following is a non-exhaustive list of error codes that may occur while using this API. These codes are in addition to any of our generic error codes.

Code Details
1000

Throttled - You have exceeded the submission capacity allowed on this account. Please wait and retry

1010

Missing params - Your request is incomplete and missing some mandatory parameters.

1020

Invalid params - The value of one or more parameters is invalid.

1021

Invalid tag - The tag value is invalid.

1022

Invalid template - Invalid template or template parameters

1030

Internal error - There was an error processing your request in the Platform.

1040

Invalid message - The Platform was unable to process your request. For example, due to an unrecognised prefix for the phone number.

1050

Number barred - The number you are trying to submit to is blacklisted and may not receive messages.

1060

Partner account barred - The api_key you supplied is for an account that has been barred from submitting messages.

1070

Partner quota exceeded - Your pre-paid account does not have sufficient credit to process this message.

1080

Account not enabled for REST - This account is not provisioned for REST submission, you should use SMPP on the SMS API.

1090

Message too long - The length of udh and body was greater than 140 octets for a binary type SMS request.

1100

Communication Failed - Message was not submitted because there was a communication failure.

1120

Illegal Sender Address - rejected - Due to local regulations, the SenderID you set in from in the request was not accepted. Please check the Global messaging section.

1130

Invalid TTL - The value of ttl in your request was invalid.

1140

Facility not allowed - Your request makes use of a facility that is not enabled on your account.

1150

Invalid Message class - The value of message-class in your request was out of range. See https://en.wikipedia.org/wiki/Data_Coding_Scheme.

1160

Non White-listed Destination - The phone number you set in to is not in your pre-approved destination list. To send messages to this phone number, add it using Dashboard.

1170

Invalid or Missing Msisdn Param - The phone number you supplied in the to parameter of your request was either missing or invalid.

1180

Absent Subscriber Temporary - This message was not delivered because to was temporarily unavailable. For example, the handset used for to was out of coverage or switched off. This is a temporary failure, retry later for a positive result.

1190

Absent Subscriber Permanent - to is no longer active, You should remove this phone number from your database.

1200

Portability Error - There is an issue after the user has changed carrier for to. If the user wants to receive messages from you, they need to contact their carrier directly.

1210

Anti-Spam Rejection - Carriers often apply restrictions that block messages following different criteria. For example on SenderID or message content.

1220

Handset Busy - The handset associated with to was not available when this message was sent. If status is rejected, this is a temporary failure; retry later for a positive result. If status is submitted, this message has is in the retry scheme and will be resent until it expires in 24-48 hours.

1230

Network Error - A network failure while sending your message. This is a temporary failure, retry later for a positive result.

1240

Illegal Number - You tried to send a message to a blacklisted phone number. That is, the user has already sent a STOP opt-out message and no longer wishes to receive messages from you.

1241

Too many send requests - Too many send requests to phone numbers.

1250

Unroutable - The chosen route to send your message is not available. This is because the phone number is either currently on an unsupported network or on a pre-paid or reseller account that could not receive a message sent by from. To resolve this issue either email us at support@nexmo.com or create a helpdesk ticket at https://help.nexmo.com.

1260

Destination unreachable - The message could not be delivered to the phone number. If using Viber Service Messages your account might not be enabled for this country.

1270

Subscriber Age Restriction - The carrier blocked this message because the content is not suitable for to based on age restrictions.

1280

Number Blocked by Carrier - The carrier blocked this message. This could be due to several reasons. For example, to's plan does not include SMS or the account is suspended.

1290

Pre-Paid - Insufficient funds - to’s pre-paid account does not have enough credit to receive the message.

1300

Not part of the provider network - The number or ID is not a user in the provider network.

1310

Not suitable device - The user's device can't receive the message.

1320

Message already sent - The message was already sent.

1330

Unknown - An unknown error was received from the carrier who tried to send this this message. Depending on the carrier, that to is unknown. When you see this error, and status is rejected, always check if to in your request was valid.

1331

Provider error - The provider is not responding or unable to process the request. Please try sending your message in a few minutes time.

1340

Outside of the allowed window - This message is sent outside of allowed response window.

1350

Phone matching fee not paid - Requires phone matching access fee to be paid by the Facebook Page.

1360

TTL was activated - TTL was activated, no callbacks and no charge will be issued.

1370

Expired access Token - Please reauthenticate your Facebook Page with Nexmo.

1380

Invalid resource - Please check that the URL your provided to your resrouce is accesible and valid.

1381

Resource size is too large - Please try sending a smaller media file.

1382

Resource type is invalid - Please check that the file you are trying to send is valid.