Executing SmartFlows from Google Cloud

Description

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.

How to

Create a Google Cloud function

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

4.  Open the Functions Overview page in the Cloud Console.

 

5.  Select the project for the Cloud Function which you enabled.

 

6.  Click Create function.

 

7.  Name your function.

 

8.  In the Trigger field, select HTTP Trigger.

 

9.  In the Source code field,select Inline editor.

 

10.  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'

11.  Click Create.

 

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

Update Your SmartFlows

12: Create Your SmartFlow.

 

See Executing SmartFlows from an External Source

For serverless functions: See Creating a AWS Lambda to Execute a SmartFlow