JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q42911F
  • License MIT

Community supported, client library for AT&T API Marketplace

Package Exports

  • @collaborizm/apimarket

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@collaborizm/apimarket) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

AT&T API Marketplace - Community Nodejs Client

npm version

Get started with the new API Marketplace at https://apimarket.att.com

Install

$ npm i @collaborizm/apimarket

Built with Typescript, types included!

Authentication

Library automatically refreshes access tokens, no need to worry about testing for token experation.

 import { APIMarketplaceClient } from '@collaborizm/apimarket'

 // for user authentication 
 const apiMarketplaceClient = new APIMarketplaceClient({
                                   username: '<USERNAME>',
                                   password: '<PASSWORD>',
                                   grant_type: 'password',
                                   client_id: '<CLIENT_ID>',
                                   scope: 'openid'
                                 })
 
 // for project authentication                                                           
 const apiMarketplaceClient = new APIMarketplaceClient({
                                   username: '<USERNAME>',
                                   password: '<PASSWORD>',
                                   grant_type: 'password',
                                   client_id: '<CLIENT_ID>',
                                   scope: 'openid'
                                 })
 
 // returns and object { id_token, access_token, id_token_decoded})          

Usage with API Marketplace Javascript SDK

// Execute authentication on server

// getValidToken will automatically refresh your access token if it's about to expire  
const tokenFromServer = await apiMarketplaceClient.getValidToken() 



 // Include JS SDK included on client  
 
 const kandy = Kandy.create({
      
  logs: {
    logLevel: 'debug'
  },
  authentication: {
    server: {
      base: 'oauth-cpaas.att.com'
    },
    clientCorrelator: 'sampleCorrelator'
  }
})

const { id_token, access_token } = authenticateProject

this.kandy.setTokens({ idToken: id_token, accessToken: access_token })

Simple send SMS message

Creates a communication channel if one doesn't exist and sends an SMS

  await apiMarketplaceClient.simpleSmsSend({
    toAddress: '+15555555555',
    fromAddress: '<ADDRESS_MUST_BE_PROVISIONED>',
    message: 'Hey',
    callbackUrl: 'http://example.com/callback'
  })

REST API Methods

If you'd like to use any of the standard REST api methods, they're all here too

  await apiMarketplaceClient.sendSMS({
    toAddress: '+15555555555',
    fromAddress: '<ADDRESS_MUST_BE_PROVISIONED>',
    message: 'Hey',
    clientCorrelator: '<FROM COMMUNICATION CHANNEL>'
  })