Interact with activities
Get up and running with Awell Orchestration in less than a day
This page will allow users to complete a pathway or flow and is a low-code integration.
The basic lifecycle for a hosted pathway experience looks like this:
pathway.completed
) is triggered to let you know the pathway is completed.The hosted pathway integration requires minimal coding. Compare the hosted pathway integration to other options to determine which option meets your requirements .
To get started, there are a couple of things you need:
To get started quickly with this guide, use a template pathway to test this integration. Choose the pathway definition id in the environment you are integrating against.
Environment | Pathway definition id |
---|---|
Sandbox | J0oNK2V91RL2 |
Production | Not available yet |
You can configure Webhooks to get notified when a pathway is started and/or completed. Webhooks are configured on a per pathway basis via the pathway settings so if you want to receive webhooks for these events, you will have to configure them via the pathway settings.
Configure webhooks
Add a start pathway button
Add a button to your page. When a client clicks this button, they are redirected to the Awell-hosted pathway page.
Show a message when client is redirected back
We want to show something to the client when they get redirected back to the application. In this case, we show a simple message.
Check if there is a redirect back from Hosted Pathway
We want to show something to the client when they get redirected back to the application. In this case, we show a simple message.
01import React, { useState, useEffect } from "react";0203const StartPathwaySessionButton = () => (04 <form action="/start-pathway-session" method="POST">05 <button type="submit">06 Start pathway session07 </button>08 </form>09);1011const Message = ({ message }) => (12 <p>{message}</p>13);1415export default function App() {16 const [message, setMessage] = useState("");1718 useEffect(() => {19 const query = new URLSearchParams(window.location.search);2021 if (query.get("success")) {22 setMessage("Pathway completed.");23 }2425 if (query.get("canceled")) {26 setMessage(27 "Pathway canceled."28 );29 }30 }, []);3132 return message ? (33 <Message message={message} />34 ) : (35 <StartPathwaySessionButton />36 );37}
Install node-fetch library
Your server will need to call the Awell (GraphQL) API. In this example we use node-fetch, but feel free to use any library of your liking.
01npm install node-fetch
Configure variables
You will need an API key to authorize requests to the Awell API and a pathway definition id to indicate what pathway you would like to start.
Resources:
Create a pathway session
Add an endpoint on your server that creates a Pathway Session. A session is created by calling the Awell API (graphql).
Resources:
Define a patient resource to start the pathway for Optional
Every pathway is linked to a patient resource in our system. We automatically create an anonymous patient resource if
patient_id
If you want to create a patient first, you will have to do an a priori API call to create the patient.
Resources:
Pass baseline info or baseline data points Optional
Care flows/pathways can be configured to accept sending baseline data point values (i.e. baseline information) when starting the pathway.
Add a
data_points
Resources:
Define pathway to start, success and cancel URLs
Specify what pathway needs to be started as well as the start and cancel URLs. Make sure these URLs are publicly accessible so Awell can redirect clients to them.
Redirect to Hosted Pathway page
After creating the session, redirect your client to the URL for the hosted pathway page returned in the response.
01const express = require('express');02const fetch = require('node-fetch');03const app = express();0405app.use(express.static('public'));0607const AWELL_SANDBOX_API_ENDPOINT = 'https://api.sandbox.awellhealth.com/orchestration/m2m/graphql'08const AWELL_SANDBOX_API_KEY = 'YOUR_API_KEY'09const YOUR_DOMAIN = 'https://your-domain.com'10const PATHWAY_DEFINITION_ID = "J0oNK2V91RL2"1112app.post('/start-pathway-session', async (req, res) => {13 const body = JSON.stringify({14 query: `15 mutation StartHostedPathwaySession(16 $input: StartHostedPathwaySessionInput!,17 ) {18 startHostedPathwaySession(input: $input) {19 session_id20 session_url21 pathway_id22 }23 }`,24 variables: {25 input: {26 pathway_definition_id: PATHWAY_DEFINITION_ID,27 success_url: `${YOUR_DOMAIN}?success=true`,28 cancel_url: `${YOUR_DOMAIN}?canceled=true`29 }30 }31 });3233 const session = await fetch(AWELL_SANDBOX_API_ENDPOINT, {34 method: 'POST',35 headers: {36 apiKey: AWELL_SANDBOX_API_KEY,37 Accept: 'application/json',38 'Content-Type': 'application/json'39 },40 body,41 cache: 'default'42 })43 .then(response => response.json())44 .then(response => response.data.startHostedPathwaySession)4546 res.redirect(303, session.session_url);47});4849app.listen(4242, () => console.log('Running on port 4242'));
Awell Node library
We are working on an Awell Node library that you can install to make it even more easy to access the Awell API functionalities.
Run the application
Start your applications (front-end and server) and navigate to http://localhost:3000. Press the "Start pathway session" button to go to the Awell hosted pathway page and complete the pathway.
If you can't find what you're looking for, you can always send us a message over Intercom with your enquiry.