Giter Club home page Giter Club logo

telnyx-sample's Introduction

Telnyx Sample SMS App

Description

This app demonstrates a simple messaging scenario using Telnyx's SMS Messaging API on the NestJS framework.

Requirements

Setup

Telnyx Setup

You will need to create a Telnyx account, obtain a phone number, and set up a messaging profile to get started. Follow this guide for information on how to do so.

Repo and Installation

Clone the GitHub repo and install the dependencies:

$ git clone https://github.com/elylucas/telnyx-sample.git
$ cd telnyx-sample
$ npm install

Configure Local Environment Settings

You will need to create a local environment file to supply the application with some settings.

Create a .env file in the root of the project and set the API_KEY and PHONE_NUMBER variables with settings from your application. Your API key can be found under the "API Keys" side menu in the Telnyx dashboard, and the phone number is the number you set up earlier and assigned to the messaging profile for this application.

Your .env file should look something like this:

API_KEY=<Your API Key>
PHONE_NUMBER=<Your Telnyx Phone Number>

This file does not get checked into source contol.

Running the app

Launch a ngrok session

$ ngrok http 3000

This command will tunnel any connections that come in from the forwarding URL to you local system on port 3000, which is the port that the Nest API server will listen for connections.

You will need to update your messaging profile to send webhook requests to this forwarding URL. Copy the URL and go into the messaging profile you have setup for this application in the Telynx dashboard. Paste the forwarding URL into the "Send a webhook to this URL box" and save the changes.

Note, you will need to update this webhook URL each time you restart ngrok as the URL will change each time.

Start API Server

In another terminal window, run one of the following:

$ npm run start:dev

You should now be able to send messages to your Telnyx phone number and have the app respond to the webhook reqeusts.

Test

To run the tests, run the following:

$ npm run test

Libraries Used in This Sample

  • NestJS, a great Node web framework. Choosen because it has great features with minimal fuss.
  • Telnyx Node SDK, used to send messages back to the Telnyx SMS API.

telnyx-sample's People

Contributors

elylucas avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.