Wrike Integrationについての考察【前編】

Wrike Integrationについての考察【前編】

優れたAPI設計を持ち、高度なワークフローアプリケーションを作成するための非常に強力なメソッドセットを兼ね備えたWrike。

弊社バングラデシュのエンジニアチームが、以下の3つの視点からWrike Integrationについての考察を行いました。

ぜひご覧ください。

尚、正確性を逸しないために英語原文のまま掲載いたします。ご了承ください。

※日本語版はこちらのページより無料でダウンロードしていただけます。

 

【前編】
  • WrikeをBaaS(Backend as a Service)として活用することは可能か?

WrikeをBaaSとして使用するためのToDoアプリによる検証。

  • Wrikeと他のワークフローアプリケーションを連携するには?

日本語翻訳ボット作成による検証。タスク・プロジェクトの会話セクションにコメントがあった際に自動翻訳して投稿。

【後編】

  • Workatoを利用してWrikeと他のワークフローアプリケーションを連携させるには?

ワークフローの進捗時(例:ステータスをAからBに変更時)に指定電子メールに自動送信を行う。

  • Dialogflowを使用してWrike上にタスクを作成するチャットボットを作成することは可能か?

SlackのワークスペースからWrike上にタスクを作成する。


 

Wrike Integration

for your business workflow automation

Different wrike integration options

Through this writing, I am going to look at our findings from two weeks of research on Wrike integration options as a workflow management tool with other existing business automation tools.

The Wrike perspective

Wrike is a workflow management platform that particularly focuses on making team collaboration easy, across multiple projects. More importantly, they have multiple integration options for you to connect Wrike with your existing workflow tools or applications.

The purpose of our research

After a brief introduction to Wrike and Wrike integration by Workato we started with these questions

  1. Can we use Wrike as a BaaS (backend as a service) for workflow applications?
  2. Can we integrate Wrike features into other workflow applications?
  3. How can we use Wrike integration by Workato and for what purposes?

To understand these questions we took THREE demo projects,

One: A simple ToDo app that uses Wrike as BaaS.

Two: A Japanese Translation Bot, that will post a translated comment after, when someone makes a comment on a task or project conversation section.

Three: An Email Notifier, that notifies an intended recipient through email, when a task has progressed in the workflow from one status to the next status (e.g, from status A → to status B)

Research on these questions led us to three different Wrike integration options.

The THREE Wrike integration options

Wrike application

In the beginning, as any integratable platform, we started with the application option – Wrike API App. Wrike provides OAuth 2.0 authentication and a range of very neat and concisely documented APIs. Aslo, during the development phase, Wrike allows you to use a static token.

Different Wrike integration options ToDo: Change Image for app name ToDo App

For our ToDo App, consuming their API was a nice experience. You can create your own workflow application using Wrike as a backend for your project. They have following API sets that we went through,

user groups, – so you can create groups for example admin, developers, marketing etc…

workflows, – think of your project workflow (a task lifecycle). It’s great to have custom workflows!

custom fields, – and this! you can add custom fields at the task, folder, project, and Space level.

spaces, – you can think of them as organization departments if you like, or match your use case.

folders and projects, – Wrike projects are a subset of folders.

tasks, – your project tasks / cards / tickets. Spaces and folders / projects can contain tasks.

comments, – you can add comment on spaces, folders / projects and tasks.

approvals, – this is a nice feature to organize your projects’ review processes.

There are no limitations to what number of spaces, users, tasks or any other object you can create, and they have many more API sets, that we didn’t dig into!

Wrike API responses are well thought out formats. Every successful API response returns a data array. Let’s look at a couple of examples; –

User Groups | POST /groups API

Success Response

Create a new group

 

Notice the success response, for the POST /groups API, returns {kind, data}, where kind is the data type, and data is always an array, even if in this case there is only one data. Wrike uses the same success response format for all their API methods.

User Groups | GET /groups API

Failed Response

Return all groups in the account

The failed response, for the GET /groups API, returns {errorDescription, error}, where errorDescription is the meaning of error in plain English, and error is the error identifier.

So, the answer to our first question, Can we use Wrike as a BaaS (backend as a service) for workflow applications? is Yes! The purpose of Wrike API applications is to give you access to your existing Wrike account through OAuth 2.0 authentication, using Wrike as the backend for your workflow application project.

We also wanted to find that, if we can add new functionalities to Wrike through an app, and make it available for other users. In our case, the Japanese Translation Bot. Can we publish our bot as a Wrike App? Well…no! Wrike API Apps are not for purposes like these – Wrike API apps are not like addons or extension apps. But Wrike has a better answer for this notion! – Workato Recipe! We are going to discuss more about Workato and Workato recipes below.

Things that would make it better!

Wrike is good if you are working on a new workflow project. But one thing that we could not find an answer to, – an application context. An application cannot do anything on behalf of itself. For example, in our case, a translation bot, making a comment as an application, is not possible.

Currently there is no application context token, the static API app token acts as a user token. But I think soon Wrike is going to add this functionality too! More on this later.

Webhooks

At this point we already know, for our Japanese Translation Bot, a Wrike app is not the right choice, because of the absence of application context, – a new translated comment by our bot shows as a comment by the user, but we wanted to progress on our research on Wrike webhooks with this app.

Wrike says, Webhooks allow you to subscribe to notifications about changes in Wrike. For our Japanese Translation Bot, we created a simple node.js project using express, to expose a webhook URL for Wrike.

To expose your local node.js project running port using ngrok.

exposing port 6005 using ngrok

Also, you will subscribe to TWO webhook events, – CommentAdded and FolderCommentAdded.

Subscribe to webhook events

When a user writes a new comment in a folder (/project) or a task, our webhook server receives the event through a POST request to /webhook url.

CommentAdded Webhook event

We process this event request in FOUR steps –

Translation bot functional steps

If you have successfully set up and ran the project, you can make a comment in wrike task / folder to test.

Wrike has a well structured webhook design. You can,

  • Define multiple webhook url
  • Subscribe to specific webhook events
  • secure your webhook url through a secret param

Things that would make Wrike Webhooks better

It would have been better to have UI based webhook subscription option.

The problem with application context (and webhook event type)!

As Wrike apps are not for addons or extensions apps, Wrike does not differentiate between a comment by an application and a user comment. So, if you make a new comment with the application token (in this case, translating the user’s comment that you received through webhook), Wrike shows the comment is by the user who authorized the application (created and installed the application)!

application comment is a user comment

As a result, when there is a new user comment, it triggers a second CommentAdded webhook event creating an infinite loop! But actually the second comment was by the application. As there is no way to identify a comment created by the app, we had to do a different solution.

But, if the application would act as a different OAuth 2.0 client, we could match against the client id. Or, if there was a different event type, maybe CommentAddedByApp, it would have been better!

That is, It would have been better to identify application comments and subscribe to application initiated webhook events.

Infinite loop solution

We solved the infinite loop issue with a not so standard solution

Avoid infinite loop with webhook event

 

 

 

シェアする

URLをコピーする

コピー