3.0.0 • Published 5 years ago
@datafire/nexmo_messages_olympus v3.0.0
@datafire/nexmo_messages_olympus
Client library for Messages API
Installation and Usage
npm install --save @datafire/nexmo_messages_olympus
let nexmo_messages_olympus = require('@datafire/nexmo_messages_olympus').create({
username: "",
password: "",
bearerAuth: ""
});
.then(data => {
console.log(data);
});
Description
The Messages API enables you to send messages to customers via their preferred channels (currently Facebook Messenger, WhatsApp, Viber, and SMS/MMS) using a single API. The Messages API is currently in Beta.
Actions
NewMessage
Send a Message over SMS, WhatsApp, Viber, Facebook Messenger, or MMS
nexmo_messages_olympus.NewMessage({
"body": null
}, context)
Input
- input
object
- body required message
Output
- output Response
Definitions
Error
- Error
object
: The error format is standardized to the 4xx/5xx range with a code and a human readable explanation.- detail required
string
- instance required
string
- title required
string
- type required
string
- detail required
FromProperty
- FromProperty
object
- id
string
: Your ID for the platform that you are sending from. - number
string
: 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. - type required
string
(values: sms, viber_service_msg, messenger, whatsapp, mms): The type of message that you want to send.
- id
MessageStatus
- MessageStatus
object
- client_ref
string
: The client's reference. - 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
- code
- from required FromProperty
- message_uuid required
string
: The UUID of the message. - status required
string
(values: submitted, delivered, read, rejected, undeliverable): The status of the message. Theread
message status is available formessenger
,whatsapp
andviber
. - timestamp required TimestampProperty
- to required ToProperty
- usage
object
- currency
string
(values: EUR): The charge currency in ISO 4217 format. - price
string
: The charge amount as a stringified number.
- currency
- client_ref
Response
- Response
object
- message_uuid required
string
: The UUID of the message.
- message_uuid required
Sms
- Sms
- client_ref client_ref
- from required
object
- number required
string
: 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. - type required
string
(values: sms): The channel the message is coming from
- number required
- message required
object
- content required
object
- text required
string
: 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. - type required
string
(values: text): The content type of the message
- text required
- content required
- to required
object
- number required toNumber
- type required
string
(values: sms): The channel the message is going to.
SmsCommon
- SmsCommon
object
- from required
object
- number required
string
: 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. - type required
string
(values: sms): The channel the message is coming from
- number required
- message required
object
- content required
object
- text required
string
: 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. - type required
string
(values: text): The content type of the message
- text required
- content required
- to required
object
- number required toNumber
- type required
string
(values: sms): The channel the message is going to.
- from required
TimestampProperty
- TimestampProperty
string
: The datetime of when the event occurred.
ToProperty
- ToProperty
object
- id
string
: Messenger: The ID of the message recipient. This value should be thefrom.id
value you received in the inbound messenger event. - number
string
: SMS, Viber, WhatsApp or MMS: - type required
string
(values: sms, viber_service_msg, messenger, whatsapp, mms): The type of message that you want to send.
- id
audioMessageFacebook
- audioMessageFacebook
object
- message required
object
- content required audioMessageFacebookContent
- messenger messenger
- message required
audioMessageFacebookContent
- audioMessageFacebookContent
object
- audio required
object
: The audio content being sent to the recipient.- url required
string
: The URL of the audio attachment. Supports .mp3.
- url required
- type required
string
(values: audio): The type of message being sent.
- audio required
audioMessageFacebookInbound
- audioMessageFacebookInbound
object
- message required
object
- content required audioMessageFacebookContent
- message required
audioMessageWhatsApp
- audioMessageWhatsApp
object
- message required
object
- content required
object
- audio required
object
: The audio content object for the request- url required
string
: The publicly accessible URL of the audio attachment. The audio file is available for 48 hours after it is created.
- url required
- type required
string
(values: audio): the type of message that you are sending
- audio required
- content required
- message required
channelOptionsFacebook
- channelOptionsFacebook
- from required
object
- id required
string
: This value should be theto.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. - type required
string
(values: messenger): The channel that you are sending from
- id required
- to required
object
- id required
string
: The ID of the Message recipient. This value should be thefrom.id
value you receive on an inbound message from messenger - type required
string
(values: messenger): The channel that you are sending to
- id required
- client_ref client_ref
- from required
channelOptionsFacebookCommon
- channelOptionsFacebookCommon
object
- from required
object
- id required
string
: This value should be theto.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. - type required
string
(values: messenger): The channel that you are sending from
- id required
- to required
object
- id required
string
: The ID of the Message recipient. This value should be thefrom.id
value you receive on an inbound message from messenger - type required
string
(values: messenger): The channel that you are sending to
- id required
- from required
channelOptionsInboundViberCommon
- channelOptionsInboundViberCommon
object
- from required
object
- number required
string
: 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. - type required
string
(values: viber_service_msg): The channel your message will be coming from.
- number required
- to required
object
- id required
string
: This is your Service Message ID given to you by Vonage Account Manager. To find out more please visit vonage.com/products/messages. - type required
string
(values: viber_service_msg): The channel you are sending to
- id required
- from required
channelOptionsViber
- channelOptionsViber
- from required
object
- id required
string
: This is your Service Message ID given to you by your Vonage Account Manager. To find out more please visit vonage.com. - type required
string
(values: viber_service_msg): The channel your message will be coming from.
- id required
- to required
object
- number required
string
: 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. - type required
string
(values: viber_service_msg): The channel you are sending to
- number required
- client_ref client_ref
- from required
channelOptionsViberCommon
- channelOptionsViberCommon
object
- from required
object
- id required
string
: This is your Service Message ID given to you by your Vonage Account Manager. To find out more please visit vonage.com. - type required
string
(values: viber_service_msg): The channel your message will be coming from.
- id required
- to required
object
- number required
string
: 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. - type required
string
(values: viber_service_msg): The channel you are sending to
- number required
- from required
channelOptionsWhatsapp
- channelOptionsWhatsapp
- from required
object
- number required
string
: WhatsApp Number the message is to be sent from. - type required
string
(values: whatsapp): Channel the message is going to be sent from.
- number required
- to required
object
- number required
string
: 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. - type required
string
(values: whatsapp): Channel the message is going to
- number required
- client_ref client_ref
- from required
channelOptionsWhatsappCommon
- channelOptionsWhatsappCommon
object
- from required
object
- number required
string
: WhatsApp Number the message is to be sent from. - type required
string
(values: whatsapp): Channel the message is going to be sent from.
- number required
- to required
object
- number required
string
: 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. - type required
string
(values: whatsapp): Channel the message is going to
- number required
- from required
client_ref
- client_ref
string
: client reference up to 40 characters, the reference will be present in every message status
fileMessageFacebook
- fileMessageFacebook
object
- message required
object
- content required fileMessageFacebookContent
- messenger messenger
- message required
fileMessageFacebookContent
- fileMessageFacebookContent
object
- file required
object
: The file content being sent to the recipient.- url required
string
: The URL of the file attachment. Supports .zip, .csv, and .pdf
- url required
- type required
string
(values: file): The type of message being sent.
- file required
fileMessageFacebookInbound
- fileMessageFacebookInbound
object
- message required
object
- content required fileMessageFacebookContent
- message required
fileMessageWhatsApp
- fileMessageWhatsApp
object
- message required
object
- content required
object
- file required
object
: The file content object to be sent.- url required
string
: The publicly accessible URL of the file to be sent. Supports .pdf, .doc(x), .ppt(x), and .xls(x)
- url required
- type required
string
(values: file): The type of message that you are sending.
- file required
- content required
- message required
imageMessageFacebook
- imageMessageFacebook
object
- message required
object
- content required imageMessageFacebookContent
- messenger messenger
- message required
imageMessageFacebookContent
- imageMessageFacebookContent
object
- image required
object
: The image content being sent to the recipient.- url required
string
: 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
- url required
- type required
string
(values: image): The type of message being sent.
- image required
imageMessageFacebookInbound
- imageMessageFacebookInbound
object
- message required
object
- content required imageMessageFacebookContent
- message required
imageMessageViber
- imageMessageViber
object
- message required
object
- content required imageMessageViberContent
- viber_service_msg viber_service_msg
- message required
imageMessageViberContent
- imageMessageViberContent
object
- image required
object
: Image content to be sent- url required
string
: 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.
- url required
- type required
string
(values: image): The type of message being sent
- image required
imageMessageViberInbound
- imageMessageViberInbound
object
- message required
object
- content required imageMessageViberContent
- message required
imageMessageWhatsApp
- imageMessageWhatsApp
object
- message required
object
- content required
object
- image required
object
: image content object- caption
string
: Additional text to accompany the image. - url required
string
: 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
- type required
string
(values: image): The type of message that you are sending
- image required
- content required
- message required
inbound-common
- inbound-common
object
- message_uuid required
string
: The UUID of the message. - timestamp required
string
: The datetime of when the event occurred.
- message_uuid required
inbound-message
locationMessageWhatsApp
- locationMessageWhatsApp
object
- message required
object
- content required
object
- location required
object
: location content object- address
string
: The address of the location, only displays if name is present - latitude required
string
: The latitude of the location - longitude required
string
: The longitude of the location - name
string
: Name of the Location.
- address
- type required
string
(values: location): The type of message that you are sending
- location required
- content required
- message required
message
messenger
- messenger
object
- category
string
(values: response, update, message_tag): 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. Vonage maps ourcategory
to theirmessaging_type
. Ifmessage_tag
is used, then an additionaltag
for that type is mandatory. By default Vonage sends theresponse
category to Facebook Messenger. - tag
string
: A full list of the possible tags is available on developers.facebook.com
- category
mmsMessage
- mmsMessage
- from required
object
- number required
string
: A US shortcode - type required
string
(values: mms): The channel the message is coming from
- number required
- message required
object
- content required
object
- image required
object
- url required
string
: 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
- url required
- type required
string
(values: image): The type of message to be sent
- image required
- content required
- to required
object
- number required
string
: 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. - type required
string
(values: mms): The channel the message is going to
- number required
- client_ref client_ref
- from required
mmsMessageCommon
- mmsMessageCommon
object
- from required
object
- number required
string
: A US shortcode - type required
string
(values: mms): The channel the message is coming from
- number required
- message required
object
- content required
object
- image required
object
- url required
string
: 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
- url required
- type required
string
(values: image): The type of message to be sent
- image required
- content required
- to required
object
- number required
string
: 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. - type required
string
(values: mms): The channel the message is going to
- number required
- from required
templateMessageViber
- templateMessageViber
object
- message required
object
- content required templateMessageViberContent
- message required
templateMessageViberContent
- templateMessageViberContent
object
- template required
object
: The template to be sent.- parameters templateParameters
- name required
string
: The name of the template to be sent
- type required
string
(values: template): The type of message you are sending
- template required
templateMessageViber_outbound
- templateMessageViber_outbound
object
- message required
object
- content required templateMessageViberContent
- viber_service_msg viber_service_msg
- message required
templateMessageWhatsApp
- templateMessageWhatsApp
object
- message required
object
- content required templateMessageWhatsAppContent
- whatsapp required
object
- locale required
string
: The BCP 47 language of the template. Vonage will translate the BCP 47 format to the WhatsApp equivalent. For examplesen-GB
will be auto-translate to en_GB. - policy
string
(values: deterministic): Policy for resolving what language template to use. Please note that WhatsApp deprecated thefallback
policy in January of 2020, all requests carrying afallback
policy will be rejected with a 400 error
- locale required
- message required
templateMessageWhatsAppContent
- templateMessageWhatsAppContent
object
- template required
object
: The Template request object to be sent to WhatsApp.- parameters templateParameters
- name required
string
: 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.
- type required
string
(values: template): the type of message that you are sending
- template required
templateMessageWhatsAppInbound
- templateMessageWhatsAppInbound
object
- message required
object
- content required templateMessageWhatsAppContent
- message required
templateParameters
- templateParameters
array
: The parameters are an array. The first value being {{1}} in the template.- items
string
- items
textMessageFacebook
- textMessageFacebook
object
- message required
object
- content required textMessageFacebookContent
- messenger messenger
- message required
textMessageFacebookContent
- textMessageFacebookContent
object
- text required
string
: The text to be sent to the recipient's Facebook Messenger account. - type required
string
(values: text): The type of message being sent.
- text required
textMessageFacebookInbound
- textMessageFacebookInbound
object
- message required
object
- content required textMessageFacebookContent
- message required
textMessageViber
- textMessageViber
object
- message required
object
- content required textMessageViberContent
- viber_service_msg viber_service_msg
- message required
textMessageViberContent
- textMessageViberContent
object
- text required
string
: Text to be sent to the user, limited to 1000 characters, including unicode. - type required
string
(values: text): The type of message being sent
- text required
textMessageViberInbound
- textMessageViberInbound
object
- message required
object
- content required textMessageViberContent
- message required
textMessageWhatsApp
- textMessageWhatsApp
object
- message required
object
- content required
object
: Content of the whatsapp message- text required
string
: Text Message limited to 4096 characters, including unicode. - type required
string
(values: text): The type of message that you are sending
- text required
- content required
- message required
toNumber
- toNumber
string
: 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.
unsupportedMessage
- unsupportedMessage
object
- message required
object
- content required
object
- type required
string
(values: unsupported): The type of message will beunsupported
if a message is received is of an unsupported type
- type required
- content required
- message required
viber_service_msg
- viber_service_msg
object
- category
string
(values: transaction, promotion): 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 Vonage sends thetransaction
category to Viber Service Messages. - ttl
integer
: 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 Vonage Account Manager to setup your templates. To find out more please visit vonage.com/products/messages.
- category
videoMessageFacebook
- videoMessageFacebook
object
- message required
object
- content required videoMessageFacebookContent
- messenger messenger
- message required
videoMessageFacebookContent
- videoMessageFacebookContent
object
- type required
string
(values: video): The type of message being sent. - video required
object
: The video content being sent to the recipient.- url required
string
: The URL of the video attachment. Supports .mp4.
- url required
- type required
videoMessageFacebookInbound
- videoMessageFacebookInbound
object
- message required
object
- content required videoMessageFacebookContent
- message required
videoMessageWhatsApp
- videoMessageWhatsApp
object
- message required
object
- content required
object
- type required
string
(values: video): The type of message that you are sending - video required
object
: the video content object for the WhatsApp request- url required
string
: Publicly accessible URL of the video attachment.
- url required
- type required
- content required
- message required
3.0.0
5 years ago