npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

feedbot-azure-function

v1.8.0-alpha.3

Published

Template for deploying Feedbot platform instance (botbuilder bot + designer) into Azure Functions environment.

Downloads

44

Readme

Feedbot Azure Function

This repo is skeleton used for development of Feedbot and its deployment into the Azure Function environment. Its split into three separate functions, each of them with its own API:

  • messages is the main botbuilder messaging endpoint which is wrapped by the feedbot-node-sdk (it is bootstrapped and configured using env variables in messages/index.js file)
  • management is custom API determined for non-messaging calls of Feedbot (mainly from Designer), for example:
    • get current version of bot tree
    • push new version of bot tree
    • get users handoff state
    • trigger some user's handoff
  • file-upload is custom API for uploading images (encoded to base64) to azure blob storage.
    • optional parameters: http://localhost:7071/api/file-upload/{filename?}/{thumbnail?}/{thumbnailHeight?}
    • if BlobAccountUrl environment variable is set, then POST response will return image url based on this variable.
    • if BlobAccountUrl is not set, then AzureWebJobsStorage will be automatically parsed for AccountNameparameter and custom image url returned.

    don't forget to set AzureWebJobsStorage in local.settings.json file too

  • proactive-messages is default botbuilder Proactive template's function for proactive messaging (when bot wants to send message to user by its own using Azure Storage Queue - for example when some long duration processing is finished)

Setup

Following setup includes preparing your workspace for working with Azure Functions in production environment. Development environment works without this step.

  • create local.settings.json file and paste the following:
{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "node",
    "NODE_OPTIONS": "--inspect=5858"
  },
  "Host": {
    "LocalHttpPort": 7071,
    "CORS": "*"
  },
  "ConnectionStrings": {
    "SQLConnectionString": "Value"
  }
}

Development

There are two ways how to run azure-function locally:

  1. npm start - uses ts-node and nodemon to run messages/index.js endpoint only in a development environment with automatic restart on source file changes.

  2. npm run func - uses a simulated Azure Functions environment to run all functions in parallel in a production environment

    • install azure-functions-core-tools (guide) globally first (on Mac need to force version using npm i -g [email protected])
    • update Node.js to the new version. You can use nvm - Node Version Manager (Installer) or node.js (Installer). For nvm use nvm ls to see installed node versions on your machine and nvm use <version> to switch to a newest version. Guide
    • in case of Missing value for AzureWebJobsStorage in local.settings.json error, change extension of file proactive-messages/function.json to something else temporarily OR just add AzureWebJobsStorage value in packages/azure-storage/local.settings.json.

Both of these scripts start bot instance on localhost:7071/api/messages and you can use Bot Framework Emulator to test it's behavior which is loaded from messages/tree/default.json (or "FeedbotTreeFile" environment variable).

To emulate Azure Storage environment, .env file needs to configure one setting:

  • create .env file at the root of the azure-functions folder and insert the following:

    AzureWebJobsStorage="UseDevelopmentStorage=true"

Deployment

Deploying new Feedbot instance is described in wearefeedyou/feedbot wiki

Configuration

You can configure the behaviour of chatbot with several environment variables, defined in .env file:

NODE_ENV="development" //options: [ "development", "production" ]
FeedbotTreeFile="default" //points to azure-function/messages/tree/default.json
port=7071 //port for express to listen to

AzureWebJobsStorage="UseDevelopmentStorage=true" //azure-storage account string

FeedbotTestModeEmailRecipient="[email protected]" //email address to send emails to

// result storage related items:
ResultStorageExcelSpreadsheetId="1234567890"
ResultStorageExcelSheetName="List1"
ResultStorageClientId="1234567890"
ResultStorageClientSecret="abcd1234"
ResultStorageRefreshToken="abcdefghij1234567890"
ResultStorageSuccessFactorsCompanyUsername="User"
ResultStorageSuccessFactorsCompanyPassword="Password"
ResultStorageSuccessFactorsCompanyId="Company"

// www.Amio.io related items:
AmioChannelId1="1234567890"
AmioSecret1="abcd1234"
amioAccessToken="abcdefghij1234567890"
QuickReplyImageUrl="http://tny.im/i4e" //image for QuickReply button for Facebook

// www.Teamio.com related items:
TeamioLogin="User"
TeamioPassword="Password"

Tools

Insomnia

Insomnia is used for making requests to REST APIs: Insomnia REST Client

Microsoft Azure Storage Explorer

Microsoft Azure Storage Explorer is used for tracking table/blob/queue storage values in the azure-storage database: Microsoft Azure Storage Explorer

Microsoft Bot Framework Emulator

Microsoft Bot Framework Emulator simulates user-side interaction environment with Feedbot: Bot Framework Emulator