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
- Select or create a Cloud Project from the Google Cloud Console project selector page.
- Confirm billing is enabled for your project.
- Enable the Cloud Functions API.
- Open the Functions Overview page in the Cloud Console.
- Select the project for the Cloud Function you enabled.
- Click Create function.
- Name your function.
- In the Trigger field, select HTTP Trigger.
- In the Source Code field, select Inline editor.
- Paste the following into the code editor:
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'
- 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:
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.