Search code examples
podio

Create Podio App Workflows using API - PHP


I'm using Flows API to create new workflows.

API: https://developers.podio.com/doc/flows/add-new-flow-26309928

I've prepared the attributes properly (by referring the API documentation). It is not working as expected and returning an error while creating flows with effects. I was able to create a flow without any effects, ie. a null flow which does nothing. But when I tried to create flow with effects, it shows error as below.

PodioServerError: An unexpected error occurred during execution.

Below given is my code part,

 $attributes = array(
            'config' => array(
                'conditions' => array()
            ),
            "effects" => array(array(
                "values" => array(
                    'attribute_id' => "comment.value",
                    'label' => "Comment",
                    'required' => true,
                    'substitutions' => array(),
                    'type' => "text",
                    'value' => "This is a test comment from flow"
                ),
                'type' => "comment.create",
            )),
            'name' => 'Test Flow via API',
            'type' => 'item.create'
        );
    PodioFlow::create('app', $appID, $attrib);

Any idea what could be the error or how to properly debug this?


Solution

  • Can you please try:

    $attributes = array(
                'config' => array(
                    'conditions' => array()
                ),
                "effects" => array(array(
                    "attributes" => array(array(
                        'attribute_id' => "comment.value",
                        'label' => "Comment",
                        'required' => true,
                        'substitutions' => array(),
                        'type' => "text",
                        'value' => "This is a test comment from flow"
                    )),
                    'type' => "comment.create",
                )),
                'name' => 'Test Flow via API',
                'type' => 'item.create'
            );
    

    The only difference is values were replaced with attributes inside effects. That was mistype in docs, sorry, it's fixed now.