GithubHelp home page GithubHelp logo

methusael13 / intercom-hasura Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 1.0 1.04 MB

Intercom Webhook built on the Hasura platform (Intern task)

JavaScript 81.93% HTML 2.83% CSS 15.24%
hasura intercom-api webhook-api nodejs reactjs javascript

intercom-hasura's Introduction

Intercom Webhook

A custom Hasura service that acts as an Intercom Webhook. The project allows one to create a very basic static keyword - response type bot. The frontend interface has an editable table that one can use to add the keyword - response pairs. Testing the bot is easily done with the Intercom chat app on the bottom right section of the screen.

Hasura hub: https://hasura.io/hub/project/omnicron/intercom-webhook

Guide

Add your cluster to the project

hasura cluster add <cluster-name> <alias> (Not required if cloned through hasura quickstart)

Set your cluster to be default

hasura cluster set-default <alias> (Not required if cloned through hasura quickstart)

Set cluster name

To deploy the project in your own cluster, all you need to do is set the proper cluster name value in the ui microservice to that of yours.

  • Replace the cluster name in microservices/ui/app/src/components/Config.js
  • Replace the cluster name in microservices/ui/app/package.json, in the start and build keys of the scripts object.

Deploy

When done, deploy the code to your cluster using git push <alias> master.

Customizing

The project contains two microservices, ui for the frontend, in ReactJS and api for the backend in NodeJS.

Frontend

The frontend is completely built using custom components, while using react-router for SPA redirection and react-motion for transition animations. Every major component is written within a separate file to making them easier to reuse and manage. The style for each such component is also available as ui/app/src/components/css/<Component>.css, where Component is the filename of the corresponding React component.

Backend

Most of the backend code is present in the microservices/api/src/server.js file.

The REST API involves the following endpoints:

  • /intercom (GET): A dummy endpoint to test if the server is working.
  • /intercom_webhook (POST): Processes and replies to webhook notifications from Intercom. This is where the app generated replies to the user are dispatched from.
  • /add_entries (POST): Accepts JSON object with the format { data: [Object] }, where data is an array of objects of type { key: <string>, message: <string> }. Keys are case-insensitive. This submitted data is stored in the database which can then be used in the Intercom bot.
  • /get_value (GET): Endpoint to test the return message for a given key. The format for the request could look like https://api.cluster-name.hasura-app.io/get_value?key=hello.

intercom-hasura's People

Contributors

methusael13 avatar

Watchers

 avatar  avatar  avatar

Forkers

muphet

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.