GRPC

📘

Beta Feature

Please contact your support team if you have questions or feedback

gRPC is a system 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” customers. If you’re logging into app.usemodernlogic.com then this won’t work for you.

Why would I want this: it’s fast! Somewhere between 7-10x faster than regular API calls. Companies with very tight SLA requirements can see significant performance gains here

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 the Input block is selected.

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.

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


Did this page help you?