Executing SmartFlows from Google Cloud

Overview

To execute SmartFlows from Google Cloud, you need the following:

Note: The example Google Cloud function code in Node.js is provided as-is. Adapt the example to your use case or design your own in your preferred programming language.

Create a Google Cloud Function

  1. Select or create a Cloud Project from the Google Cloud Console project selector page.
  2. Confirm billing is enabled for your project.
  3. Enable the Cloud Functions API.

On this Google Cloud Platform page you can select a porject or create a project where your application will be registered

  1. Open the Functions Overview page in the Cloud Console.
  2. Select the project for the Cloud Function you enabled.
  3. Click Create function.
  4. Name your function.
  5. In the Trigger field, select HTTP Trigger.
  6. In the Source Code field, select Inline editor.
  7. Paste the following into the code editor:
Copy
import requests
import json
def executeSmartflows(request):
request_json = request.get_json()
url = 'https://smart-flows.intelepeer.com/v2/api/apitriggers'
data = {
'ANI': “<Enter customer identifier>,”
'message': “<Enter message to send to SmartFlows>”,
'DNIS': “<Your DNIS value>”,
'flowId': “<Your SmartFlow Id>”,
… Enter Additional Parameters …
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.post(url, data=json.dumps(data), headers=headers)
return 'success'
  1. Click Create.

After clicking Create, Cloud Console redirects to the Cloud Functions Overview page. A small spinner icon appears next to your function while the function is being deployed. Once deployed, the spinner turns to a green check mark:

On the Cloud Functions Overview page the function appears in a table with a green check mark to the left

Update Your SmartFlow

Check out Executing SmartFlows from an External Source for more information.

For serverless functions, see Creating an AWS Lambda Serverless Function to Execute a SmartFlow.