make.comintegromat-apps

JSON-RPC Protocol in Integromat apps


How can the json-rpc protocol be implemented in a custom Integromat app? I have not found anithing on the theme in Integromat docs.


Solution

  • There isn't anything specific to a JSON-RPC request and response that would prevent Integromat apps from communicating with this kind of APIs.

    One difference is that the URL is usually the same across all modules, while the method is specified inside the request body. The ID of the request can be a random number and the parameters are sent in the body, alongside the method name.

    Looking at the code example below, the url is the same as the baseUrl and the body.id is an auto-generated UUID. The JSON-RPC response body contains a field named result, which is where you'll find the actual data that should be output by the module.

    {
        "url": "/",
        "method": "POST",
        "body": {
            "method":"createAccount",
            "params": {
                "objects": [
                    "{{parameters}}"
                ]
            },
            "id": "{{uuid}}"
        },
        "response": {
            "output": "{{body.result.account}}"
        }
    }