Giter VIP home page Giter VIP logo

Comments (1)

jBernavaPrah avatar jBernavaPrah commented on June 2, 2024

Hi guys! Posting here the response that I was given on Slack from @rmtuckerphx for those who will have the same question.

There are 2 ways to approach this:
- Write code that maps the vonage request/response to a Jovo CorePlatform-derived request response. You are responsible for converting between the two usually in the server.express.ts file
- Write your own implementation that requires you to create: Vonage.ts, VonageDevice.ts, VonagePlatform.ts, VonageRequest.ts, VonageResponse.ts and VonageUser.ts.

The best way to do option 2 is to look at the Facebook and Alexa platforms
https://github.com/jovotech/jovo-framework/tree/v4/latest/platforms/platform-facebookmessenger/src
https://github.com/jovotech/jovo-framework/tree/v4/latest/platforms/platform-alexa/src
Option 2 is the most powerful. If vonage uses HTTPS endpoint and the body of the request is the request object that you want to use, you can use the existing ExpressJs class.
Important parts using Facebook as an example:
- FacebookMessangerRequest - defines the structure of the request JSON and get/set functions map to properties on that object. Pay attention to getRequestId, getInputText
- FacebookMessangerResponse - defines structure of output JSON
- FacebookMessangerUser - id property maps to property on this.jovo.$request which is set as part of call to ExpressJs
- FacebookMessangerPlatform - ties everything together. Pay attention to isRequestRelated as that is how Jovo knows to pick a platform based on the request JSON. All it does is pick a few properties from the request that will identify this JSON as belonging to one platform instead of another. Similarly, there is a isResponseRelated.

Thanks, @rmtuckerphx!

from jovo-framework.

Related Issues (20)

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.