We've made it easy to get started.
or
Just grab the code from GitHub and deploy it to your Salesforce org with the included Ant script.
If you have a previous version of Nexmo-Salesforce library installed, you will need to use Ant to install/update:
-
Checkout or download the nexmo-salesforce library from GitHub.
$ git clone [email protected]:o-rod-1/nexmo-salesforce.git
-
Install the Force.com Migration Tool plugin for Ant, if you don't already have it.
-
Edit
install/build.properties
to insert your Salesforce username and password. Since you will be using the API to access Salesforce, remember to append your Security Token to your password. -
Open your command line to the
install
folder, then deploy using Ant:$ ant deployNexmo
Now all the library code is in your org and you're ready to start coding!
Getting started with the Nexmo API couldn't be easier.
- Use or create Nexmo account. Your API key and secret can be found and updated under the "API settings" section on the Settings page in the Nexmo Dashboard.
- Go to Nexmo Configuration tab in Salesforce and validate your credentials.
Key | Description |
---|---|
TO_NUMBER | The phone number you are sending the message to. |
FROM_NUMBER | The phone number you are sending the message from. |
NOTE: Don't use a leading '+' or '00' when entering a phone number, start with the country code, for example 447700900000.
String toNumber = 'XXXXXXXXXX';
String fromNumber = 'YYYYYYYYYY';
String text = 'Test message';
String channel = 'sms'
Nexmo.sendMessage(toNumber, fromNumber, text, channel);
Key | Description |
---|---|
RECIPIENT_ID | The PSID of the user you want to reply to. The 'RECIPIENT_ID' is the PSID of the Facebook User you are messaging. This value is the 'from.id' value you received in the inbound messenger event on your Inbound Message Webhook URL. |
SENDER_ID | Your Page ID. The 'SENDER_ID' is the same as the 'to.id' value you received in the inbound messenger event on your Inbound Message Webhook URL. |
String recipientId = 'XXXXXXXXXX';
String senderId = 'YYYYYYYYYY';
String text = 'Test message';
String channel = 'messenger'
Nexmo.sendMessage(recipientId, senderId, text, channel);
Key | Description |
---|---|
TO_NUMBER | The phone number you are sending the message to. |
VIBER_SERVICE_MESSAGE_ID | Your Viber Service Message ID. |
String toNumber = 'XXXXXXXXXX';
String viberId = 'YYYYYYYYYY';
String text = 'Test message';
String channel = 'viber_service_msg'
Nexmo.sendMessage(toId, viberId, text, channel);
Key | Description |
---|---|
TO_NUMBER | The phone number you are sending the message to. |
WHATSAPP_NUMBER | Your WhatsApp number. |
String toNumber = 'XXXXXXXXXX';
String whatsAppNumber = 'YYYYYYYYYY';
String text = 'Test message';
String channel = 'whatsapp'
Nexmo.sendMessage(toId, whatsAppNumber, text, channel);
The full power of the Nexmo API is at your fingertips. Visit the full documentation for advanced topics.