Sending Voice Message with Nodejs using Sendchamp Voice API

A quick walk-through on how to seamlessly implement Sendchamp Voice API with Nodejs

Aliyu Abubakar

Aug 11, 2021

Learn how to quickly send voice messages with Node.js using sendchamp API. In this guide we will walk you through:

  1. Signing up free Sendchamp account
  2. Setting up a Nodejs Application
  3. Sending your Voice message

Prerequisite

Before you can get started, you need the following already set up:

  • Node.js and a familiarity with how to create a new app.
  • A sendchamp account

Signing up free sendchamp account

If you Already have an account? skip to the next section You can sign up for a free sendchamp account here.

image

When you sign up, you'll have to verify your email address. This allows sendchamp to verify your identity.

After you've verified your email address, you'll be asked a question in order to get you started in a way that's relevant to you.

After you finish setting up your account, you'll have access to your dashboard where you can access your API Key and perform dashboard communication functions.

Setting up a Nodejs Application

Create a new node app with NPM.

npm init 

Create a new file named index.js in the project and paste the provided "Voice SMS" code into the file.

Code Sample

var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://api.sendchamp.com/api/v1/sms/send',
  'headers': {
    'Accept': 'application/json',
    'Authorization': 'Bearer SECRET_KEY'
  },
  body: JSON.stringify({"customer_mobile_number":["2348055372961"],
"message":"Hello from Olumide Latest",
"type":"outgoing", 
"repeat":2})

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
}); 

Parameters

ParameterYour Value
customer_mobile_number required.This represents the destination phone number. E.g 2349000000000)
message required.Text message being sent.
type required.Represents the type of the message

Sending your SMS message

Now you can execute the code and send your test your voice message. Run the following command:

node index.js 

The code you used in the index.js file sends a POST request to the sendchamp API endpoint to send your voice message.

© 2022 Sendchamp. All rights reserved.