Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chipchat-tokens-to-google-secretmanager-mixin

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chipchat-tokens-to-google-secretmanager-mixin

You need to have basic understandings of the Google platform and have your service account file with sufficient rights to the project stored locally.

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
30
increased by1400%
Maintainers
1
Weekly downloads
 
Created
Source

Store Authentication tokens of ChatShipper in Google Cloud Secret Storage

You need to have basic understandings of the Google platform and have your service account file with sufficient rights to the project stored locally.

Before you can use this, you have to set the _tokens in the store from the CLI (terminal) with:

#first we export some stuff to make the command more readable

export GOOGLE_APPLICATION_CREDENTIALS=/full/path/to/serviceaccountfile.json   #Get access to your project
export TOKEN=<paste your access token here>
export REFRESHTOKEN=<paste your refresh token here>
export $GOOGLEPROJECT=<type the name of the project in google where you will create the secret and the service account has acces to>
export BOTID=<paste the bot id here>

#then create the secret holding the bots tokens:
echo -n '{"token":"'$TOKEN'", "refreshToken":"'$REFRESHTOKEN'"}' | gcloud secrets create $BOTID_tokens \
  --data-file=- --replication-policy automatic --project $GOOGLEPROJECT

Now that you have got you tokens in the store, lets use them via the mixin module like this:

const ChipChat = require('chipchat');
const { getTokens, setTokens } = require('chipchat-tokens-to-google-secretmanager-mixin');

ChipChat.mixin({ getTokens, setTokens });

// The bots email is needed to request new tokens
// with the refreshToken and is also used to store the
// tokens in the google secrest store.
// The bots user id that is found in
// the properties panel of the bot (for the bot owner)
const email = `bot+${process.env.BOTID}@chatshipper.com`;
const bot = new ChipChat({ email }); // no need for tokens, email is enought

//alternatively you can use new ChipChat({ token, refreshToken })

const conversationid = process.env.CONVERSATION;
bot.conversations.get(conversationid).then(console.log);

FAQs

Package last updated on 13 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc