Skip to content

Templates, examples and guides around adding your own Webhooks and Webviews in Moveo Channels

License

Notifications You must be signed in to change notification settings

moveo-ai/integration-guides

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Templates, examples and guides around adding your own Webhooks and Webviews into your Moveo Virtual Assistant.

Webview documentation

Webhook documentation

Getting started

  1. Install dependencies using:
npm install --legacy-peer-deps
  1. Run a local server listening on localhost:3000 by executing:
npm run dev
# or
yarn dev

Directory structure

This is a next.js project where webhooks and webviews are stored under the /pages directory

pages                                      // Webviews are stored under /pages folder
├── _app.tsx
├── _document.tsx
├── api                                    // Webhooks are stored under the /api folder
│   ├── auth
│   │   └── sign-request.ts
│   ├── common
│   │   └── random-number-generator.ts     // Returns a random number in the VA context
│   ├── ecommerce
│   │   ├── purchases-get-recent.ts        // Returns a carousel of recent purchases along with context variables
│   │   ├── mockdata
│   │   │   └── purchases.json
│   │   └── util
│   │       ├── api.ts
│   │       ├── helper.ts
│   │       ├── models.ts
│   │       └── purchases.ts
│   ├── book-tickets                       
│   │   ├── calculate-total-cost.ts        // Returns the total cost of a booking
│   │   ├── get-event-dates.ts             // Returns a text response with date options for an event
│   │   ├── get-events.ts                  // Returns a carousel of available events
│   │   ├── mockdata
│   │   │   └── events.json
│   │   ├── README.md
│   │   └── util
│   │       ├── api.ts
│   │       ├── models.ts
│   │       └── responses.ts
│   ├── lead-generation
│   │   ├── find-property.ts               // Returns a carousel of real estate properties
│   │   ├── README.md
│   │   └── util
│   │       ├── api.ts
│   │       ├── helper.ts
│   │       ├── models.ts
│   │       └── responses.ts
│   └── util
│       └── helper.ts
├── demo
│   └── demo-form.tsx                      // Webview of a simple demo form
├── web-client
│   └── web-client-instance.tsx            // Web-client example ( hosted as a webview )
├── book-tickets
│   ├── payment-form.tsx                   // Webview of a payment form
│   └── README.md
├── common
│   ├── survey.module.scss
│   └── survey.tsx                         // Webview of our default survey
├── customer-support
│   ├── README.md
│   └── return-product-form.tsx            // Webview for returning a product
├── lead-generation
│   ├── list-property-form.tsx             // Webview for listing a real estate property
│   └── README.md
└── index.tsx

Code style

  • Filenames should be kebab-case: send-email-to-panos.ts not sendEmail_ToPanos.ts
  • Moveo context is snake_case: withdrawl_amount: 30 not withdrawlAmounT: 30

Webhooks

Webhooks are HTTP endpoints that expose an API used by Moveo to communicate with 3rd party tools. Customers usually have APIs that the VA can call to then augment the session context and return responses. In some cases, Webhooks are used to send emails or add data to a Google spreadsheet.

After running your local server using (ie. npm run dev) you can "mimick" the VA calls to the webhooks using curl. For example you can get a random number by executing:

curl -X POST \
-H "Content-Type: application/json" \
-H "X-Moveo-Signature: 7b2e526f80d3ad094ee0a2ccc2501afdab7044f89839f9fcba9466d15a967774" \
-d '{"lang": "el", "channel":"web", "context": {"firstname": "John", "lastname": "Snow"}}' "localhost:3000/api/common/random-number-generator?max=100&min=1"

Webviews

Webviews are HTML pages that display information such as a Google Map or a form. The data is usually context that is retrieved and updated based on a Moveo session.

RSA keys are used to encrypt information between your custom webview form and the VA.

The RSA keys used for authentication in this repository:

Public RSA Key:

-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnhZar+5yfwp+9VSr61/U
5VKQDd6z2kdKn+mHRB+SlJA7840nSbZieA4t0g2xls2N+OcJZP1CkZdCkDR2M8bv
tKkIexc9UCnWEM9SSoOKt+XcePUxBhqgYwmuHmk6tI0afePhNagrgdntoi54dKmA
cnHAtKsxqRuDZZoQTeGO/ZqMyI+ygidXhY5Bw2a+bD1Z9LlTqhWAcIlkqZO3c7gc
t565X3eoCByuzIncQZqG+vFvpg2WhTSayeALLVD3XlZPvQZC92jvmAcdukuPvbo7
JkPAVpD/yvBb3i3Tx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pmSml2M0pTT3NBaWU3VDdNMVB3ckdMalJqVS9NeW5qRU9tOTlsSEdIWGFjV2Z2SERONis4Qlh3NWFhCnRoYXBBb0dCQUliS0UwZFZ3Z3pkdTZiMHZ4U0lsci9tNUNMd2RyM2xTaUhLSFo2d1Ayc2JyYnJ3WkdnTEFuYmQKWERRWDkwc0ppZDVZemVnenFrM0lXdU8xKy9CV3dSWXJnbTBoVEluN1RldWpXNE5WaVVHRVhOSnhESHY1TVJWeApXbHFiOExsZzM2bnMveUgxYnp2aFdkWWh5VzNVVTN0UVExejk5dE93SjFIVDd1ZkQ5a2lOCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg

Web Client

The web-client is the integration for the web.

After running the local server, you can see how to initialize the web-client using your integrationId, and customize its behavior

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!.