Sorry, you need to enable JavaScript to visit this website.

You are here

npm ERR! 404 Not Found: Telstra_Messaging

11 posts / 0 new
Last post

Michelle's picture
by Michelle

npm ERR! 404 Not Found: Telstra_Messaging

We've received this query from a dev today:

We planning to use telstra messaging service to send text messages to our user.

I am doing a proof of concept to see the feasibility study for our app.

 

we have node base app, when trying to install the telstra package using node command npm install Telstra_Messaging --save. I am getting the error 

npm ERR! code E404

npm ERR! 404 Not Found: Telstra_Messaging@latest

 

 

I'll check with the team and get back to you ASAP!

Chris's picture
by Chris

steps to resolve

Hi Michelle,

The dev can take the following to get onboard.

We will need to fix this experience, as a developer should really only have to install from npm repo. 

Regards,

Chris

MACOSC[Work]:osx ~/dev/messaging-test $ git clone https://github.com/telstra/MessagingAPI-SDK-node
Cloning into 'MessagingAPI-SDK-node'...
remote: Enumerating objects: 81, done.
remote: Counting objects: 100% (81/81), done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 398 (delta 41), reused 52 (delta 31), pack-reused 317
Receiving objects: 100% (398/398), 203.94 KiB | 349.00 KiB/s, done.
Resolving deltas: 100% (258/258), done.

MACOSC[Work]:osx ~/dev/messaging-test $ cd MessagingAPI-SDK-node/

MACOSC[Work]:osx [master|!] ~/dev/messaging-test/MessagingAPI-SDK-node $ npm i
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated flat@4.1.0: Fixed a prototype pollution security issue in 4.1.0, please upgrade to ^4.1.1 or ^5.0.1.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated

> fsevents@1.2.13 install /Users/osx/dev/messaging-test/MessagingAPI-SDK-node/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN Telstra_Messaging@2.0.1 No repository field.

added 467 packages from 547 contributors and audited 467 packages in 18.972s

36 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

MACOSC[Work]:osx [master|!?] ~/dev/messaging-test/MessagingAPI-SDK-node $ npm run build

> Telstra_Messaging@2.0.1 build /Users/osx/dev/messaging-test/MessagingAPI-SDK-node
> babel src -d dist

Successfully compiled 23 files with Babel (1481ms).

MACOSC[Work]:osx [master|!?] ~/dev/messaging-test/MessagingAPI-SDK-node $ cd ..

MACOSC[Work]:osx ~/dev/messaging-test $ npm i ./MessagingAPI-SDK-node
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN messaging-test@1.0.0 No description
npm WARN messaging-test@1.0.0 No repository field.

+ Telstra_Messaging@2.0.1
added 1 package and audited 170 packages in 2.185s

36 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

MACOSC[Work]:osx ~/dev/messaging-test $ grep MessagingAPI-SDK-node package.json

    "Telstra_Messaging": "file:MessagingAPI-SDK-node"

MACOSC[Work]:osx ~/dev/messaging-test $ cat index.js

var TelstraMessaging = require('Telstra_Messaging');

var api = new TelstraMessaging.AuthenticationApi()
var clientId = "<REDACTED>>"; // {String}
var clientSecret = "<REDACTED>"; // {String}
var grantType = "client_credentials"; // {String}
var opts = {
  'scope': "NSMS" // {String} NSMS
};
api.authToken(clientId, clientSecret, grantType, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

MACOSC[Work]:osx ~/dev/messaging-test $ node index.js

API called successfully. Returned data: [object Object]

 

 

 

 

 

 

BB's picture
by BB

Package isse got resolved

Use the same code snippet but getting below error. Able to see the logs where can see the access token. But its in the error block. The response contains two values of access token.

 

{ SyntaxError: Unexpected token { in JSON at position 89

    at JSON.parse (<anonymous>)

    at IncomingMessage.<anonymous> (/Users/bapuni/Documents/V2WorkingCopy/ClientReports/node_modules/superagent/lib/node/parsers/json.js:9:35)

    at IncomingMessage.emit (events.js:194:15)

    at endReadableNT (_stream_readable.js:1103:12)

    at process._tickCallback (internal/process/next_tick.js:63:19)

  rawResponse:

   '{"access_token":"mAS9Rs3yHmYA9VPkOZoAH0mON1YN","token_type":"Bearer","expires_in":"3599"}{"access_token":"mAS9Rs3yHmYA9VPkOZoAH0mON1YN","token_type":"Bearer","expires_in":"3599"}',

  statusCode: 200,

  response: undefined }

 

Please let me know anything wrong in my code or need to install any package.

 

Thanks

 

Chris's picture
by Chris

here is the sample I used

mmm not sure why you are having those errors, here are the files and output's I had.

file: package.json

{
  "name": "messaging-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "Telstra_Messaging": "file:MessagingAPI-SDK-node"
  }
}

file: index.js

var TelstraMessaging = require('Telstra_Messaging');

var api = new TelstraMessaging.AuthenticationApi()
var clientId = "<REDACTED>"; // {String} 
var clientSecret = "<REDACTED>"; // {String} 
var grantType = "client_credentials"; // {String} 
var opts = {
  'scope': "NSMS" // {String} NSMS
};
api.authToken(clientId, clientSecret, grantType, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, function(error) {
  console.error(error);
});

output

MACOSC[Work]:osx ~/dev/messaging-test $ node index.js
API called successfully. Returned data: {"access_token":"<REDACTED>","token_type":"Bearer","expires_in":"3599"}
MACOSC[Work]:osx ~/dev/messaging-test $

BB's picture
by BB

Issue got resolved in local envionments

Hi Chris,

Thanks for your solotion. Now able see the result in my local envionments. 

Question is if i want to move the code to git repository please let me know what should we do in following scenarios .

1.Should we check in the MessagingAPI-SDK-node folder entirly. If yes then there are two git file which refer to two different respo(one is out project repo and other is SDK repo).How to push the code.

2.Should we delete .git file from the SDK folder and push entire folder ?

Please clarify and let me know if you need further information.

 

Thanks in advance.

 

 

 

Chris's picture
by Chris

remove MessagingAPI-SDK-node git folder before commit

Yes that is also what I'd do in this case, at least until Telstra publish the Messaging API v2 to public npm repo.

I'd also move the SDK into a libs folder, something like, "lib/MessagingAPI-SDK-node".

Here is what I retested with the lib folder and .git removal.

MACOSC[Work]:osx ~/dev $ mkdir messaging-test
MACOSC[Work]:osx ~/dev $ cd messaging-test
MACOSC[Work]:osx ~/dev/messaging-test $ git clone https://github.com/telstra/MessagingAPI-SDK-node
Cloning into 'MessagingAPI-SDK-node'...
remote: Enumerating objects: 81, done.
remote: Counting objects: 100% (81/81), done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 398 (delta 41), reused 52 (delta 31), pack-reused 317
Receiving objects: 100% (398/398), 203.94 KiB | 431.00 KiB/s, done.
Resolving deltas: 100% (258/258), done.
MACOSC[Work]:osx ~/dev/messaging-test $ rm -rf MessagingAPI-SDK-node/.git
MACOSC[Work]:osx ~/dev/messaging-test $ mkdir lib
MACOSC[Work]:osx ~/dev/messaging-test $ mv MessagingAPI-SDK-node lib/.
MACOSC[Work]:osx ~/dev/messaging-test $ cd lib/MessagingAPI-SDK-node/
MACOSC[Work]:osx ~/dev/messaging-test/lib/MessagingAPI-SDK-node $ npm i
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated flat@4.1.0: Fixed a prototype pollution security issue in 4.1.0, please upgrade to ^4.1.1 or ^5.0.1.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated

> fsevents@1.2.13 install /Users/osx/dev/messaging-test/lib/MessagingAPI-SDK-node/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN Telstra_Messaging@2.0.1 No repository field.

added 467 packages from 547 contributors and audited 467 packages in 13.699s

36 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

MACOSC[Work]:osx ~/dev/messaging-test/lib/MessagingAPI-SDK-node $ npm run build

> Telstra_Messaging@2.0.1 build /Users/osx/dev/messaging-test/lib/MessagingAPI-SDK-node
> babel src -d dist

Successfully compiled 23 files with Babel (1215ms).
MACOSC[Work]:osx ~/dev/messaging-test/lib/MessagingAPI-SDK-node $ cd ..
MACOSC[Work]:osx ~/dev/messaging-test/lib $ cd ..
MACOSC[Work]:osx ~/dev/messaging-test $ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help init` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (messaging-test)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/osx/dev/messaging-test/package.json:

{
  "name": "messaging-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "directories": {
    "lib": "lib"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes)
MACOSC[Work]:osx ~/dev/messaging-test $ touch index.js
MACOSC[Work]:osx ~/dev/messaging-test $ code .
MACOSC[Work]:osx ~/dev/messaging-test $ npm i lib/MessagingAPI-SDK-node
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN messaging-test@1.0.0 No description
npm WARN messaging-test@1.0.0 No repository field.

+ Telstra_Messaging@2.0.1
added 1 package and audited 170 packages in 2.155s

36 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

MACOSC[Work]:osx ~/dev/messaging-test $ ls -al
total 384
drwxr-xr-x    7 osx  staff   224B 30 Sep 11:01 ./
drwxr-xr-x@ 255 osx  staff   8.0K 30 Sep 10:58 ../
-rw-r--r--    1 osx  staff   532B 30 Sep 11:00 index.js
drwxr-xr-x    3 osx  staff    96B 30 Sep 10:59 lib/
drwxr-xr-x    3 osx  staff    96B 30 Sep 11:01 node_modules/
-rw-r--r--    1 osx  staff   182K 30 Sep 11:01 package-lock.json
-rw-r--r--    1 osx  staff   334B 30 Sep 11:01 package.json
MACOSC[Work]:osx ~/dev/messaging-test $ ls -al node_modules/
total 0
drwxr-xr-x  3 osx  staff    96B 30 Sep 11:01 ./
drwxr-xr-x  7 osx  staff   224B 30 Sep 11:01 ../
lrwxr-xr-x  1 osx  staff    28B 30 Sep 11:01 Telstra_Messaging@ -> ../lib/MessagingAPI-SDK-node
MACOSC[Work]:osx ~/dev/messaging-test $ cat package.json
{
  "name": "messaging-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "directories": {
    "lib": "lib"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "Telstra_Messaging": "file:lib/MessagingAPI-SDK-node"
  }
}
MACOSC[Work]:osx ~/dev/messaging-test $ cat index.js
var TelstraMessaging = require('Telstra_Messaging');


var api = new TelstraMessaging.AuthenticationApi()
var clientId = "XXXXXXXXXX"; // {String}
var clientSecret = "XXXXXXXXXX"; // {String}
var grantType = "client_credentials"; // {String}
var opts = {
  'scope': "NSMS" // {String} NSMS
};
api.authToken(clientId, clientSecret, grantType, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, function(error) {
  console.error(error);
});
MACOSC[Work]:osx ~/dev/messaging-test $ node index.js
API called successfully. Returned data: {"access_token":"XXXXXXXXXX","token_type":"Bearer","expires_in":"3599"}
MACOSC[Work]:osx ~/dev/messaging-test $

 

BB's picture
by BB

Issue with the build

Hi Chris,

Thanks for the details description.

It doesnot resolve the issue.We are using docker to build and deploy. since we have to build the command from two different directory one from the root directory which has main code another need to build from the folder we have added for TelstraSDK. Since docker intitially clears all its unable to find the package.json in the SDK folder hence build is failing every time. Do have idea how to fix this?

In your setup documents its mentioned that we can public the package. To publish the library as a npm, please follow the procedure in "Publishing npm packages". Are you talking about to publish the Telstra_messging package there?. If we publish to npm registry they I guess it solve the issue 

Please suggest on this.

Thanks

Chris's picture
by Chris

with Docker example

Hi there,

For sure it can get interesting in a build scenario.

Here is how I'd tackle something like that;

  1. create your Docker file with the commands required to copy your src & libs into the image, build and install (inc MessagingAPI)
  2. build your docker image
  3. run your docker container
  4. test the app running in the docker container

Docker File

FROM node:latest
COPY app /app
RUN cd /app/lib/MessagingAPI-SDK-node && \
    npm i && \
    npm run build && \
    cd /app && \
    npm i lib/MessagingAPI-SDK-node
VOLUME /app
WORKDIR /app

Build docker image

MACOSC[Work]:osx ~/dev/messaging-test $ docker build -t chris/messaging-test .
Sending build context to Docker daemon  46.26MB
Step 1/5 : FROM node:latest
 ---> 784e696f5060
Step 2/5 : COPY app /app
 ---> Using cache
 ---> a7394249ef4d
Step 3/5 : RUN cd /app/lib/MessagingAPI-SDK-node &&     npm i &&     npm run build &&     cd /app &&     npm i lib/MessagingAPI-SDK-node
 ---> Running in e354b3931ef6
npm WARN Telstra_Messaging@2.0.1 No repository field.

audited 467 packages in 3.278s

36 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


> Telstra_Messaging@2.0.1 build /app/lib/MessagingAPI-SDK-node
> babel src -d dist

Successfully compiled 23 files with Babel (1288ms).
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN messaging-test@1.0.0 No description
npm WARN messaging-test@1.0.0 No repository field.

+ Telstra_Messaging@2.0.1
added 1 package and audited 170 packages in 2.037s

36 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Removing intermediate container e354b3931ef6
 ---> b1b325194f5f
Step 4/5 : VOLUME /app
 ---> Running in 3282900b498f
Removing intermediate container 3282900b498f
 ---> 5a8cdc63dc37
Step 5/5 : WORKDIR /app
 ---> Running in f3bf5a8a823a
Removing intermediate container f3bf5a8a823a
 ---> 52c69d0c0cd3
Successfully built 52c69d0c0cd3
Successfully tagged chris/messaging-test:latest

Run docker container and test messaging api

MACOSC[Work]:osx ~/dev/messaging-test $ docker run -a stdin -a stdout -i -t chris/messaging-test node index.js
API called successfully. Returned data: {"access_token":"XXXXXXXXXX","token_type":"Bearer","expires_in":"3599"}

 

Chris's picture
by Chris

regarding publishing the public package

If you are familiar with maintaining a npm package in the public repo then you could take this approach.

There is a wealth of detail on how to achieve this, you could start here, https://docs.npmjs.com/creating-and-publishing-scoped-public-packages

BB's picture
by BB

Clarification on the API

Hi Chris,

I have following points for clarification

1.Does the api stores any personal information anywhere from the request or response object of SMS service?

2.Setting of the data in the model specified are encrypted in nature to travel over network or the consumer of the services  need to implements their mechanism to secure the data.

If we need to encrypt the what mechanism we need to user here.

 

Please clarify.

Thanks

Michelle's picture
by Michelle

Moved to new thread on encryption and data

Hi bapuni.mca 

I see you have sent in a sales enquiry form and several emails on this matter.

I have moved your questions to a new thread and will respond there as soon as we have the information for you: https://dev.telstra.com/content/clarification-api-data-encryption-and-storage 

Log in or register to post comments