GRPC

GRPC is a mechanism for connecting internal services, that typically runs much faster than REST API calls. Remote Procedure Call interfaces are described using Protocol Buffers, and require some additional setup beyond what you’d use for traditional API calls - in exchange for some upfront setup work, you can call Workflows faster than ever before.

Who can use this: GRPC connections currently only work for our “private cloud” / self-hosted customers.

Why would I want this: It’s fast! We see roughly 30% faster response times when executing workflows via GRPC. Companies with very tight SLA requirements can see significant performance gains here.

GRPC can be used to trigger your workflows (inbound calls), as well as for realtime enrichment via data connector blocks inside you workflow (outbound calls)

Inbound gRPC Setup

Starting in Version 2.7.0, if a Workflow can be called using GRPC, you’ll see a GRPC endpoint displayed when click on the Input block for your Workflow.

The download icon next to the endpoint URL will download a .proto file, which is necessary to set up the call to Execute the workflow. You’ll need four items to call a workflow:

  1. the grpc endpoint URL displayed on the Input panel

  2. executeWorkflow.proto - the file downloaded above, name may vary

  3. a valid token (available on the Settings page. for admin users)

  4. workflow_input.json - a payload file (where you pass the fields into the workflow). See example below, and make sure the fields you want to pass are included in Customer, and you update the workflowId

{
  "payload": {
    "customer": {
      "first_name": "Jackson",
      "last_name": "Smith",
      "email": "[email protected]"
    }

  },
  "workflowId": 13,
  "async": false
}

You can then try hitting your workflow using grpcurl

grpcurl --import-path /path/to/proto -proto /path/to/proto/executeWorkflow.proto
-H 'Authorization: Bearer <token>' -d @ grpc-dev.usemodernlogic.com:443 
shieldrule.WorkflowGrpcService/executeWorkflow < workflow_input.json

Outbound GRPC connections

First, head over to the Credentials page, and click Add New Credential. Click GRPC call, and then continue to add your Credential details

We have a test server you can play with, or you can use your own:

URL: grpctest.usemodernlogic.com
Port: 443
Auth type: No auth

Save your credentials and return to your Workflow. Edit your graph by dragging out a GRPC Connector block, and choosing your credentials. So far this looks a lot like adding any other Data Connectors

When you start editing your GRPC Connector block, it will look fairly similar to the API Connector block, but with one key difference - you’ll need to upload a protobuf file (sample here), which defines the schema for inputs that this GRPC data source is expecting.

Once you’ve uploaded the file, pick a Method from the dropdown, and insert fields from your workflow that will be passed to this data source when the Workflow runs using handlebars. Autocomplete will work inside double brackets, so you can insert input fields, custom variables, etc just like any other data source.

Try clicking Send to verify the connection is working properly. When you see the results you expect, click Save. Once Saved, you’ll see the available Fields for you to use in subsequent rules on the Fields tab of this block, or in the autocomplete options on your rules.

Note on Proto Files (if you’re using your own)

You will need a compiled proto definition. We’ve done that for you on the test server proto file. If you’re using your own, you’ll need to run an additional command:

protoc --descriptor_set_out out.proto <yourfilehere.proto>

And use out.proto as your proto definition