Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Say hello to redesigned Cloudways, an empowering Startup Program, enhanced Staging, a new Let’s Encrypt Wildcard SSL certificate feature, and more. GET STARTED

Send Notifications to Trello Using CloudwaysBot API

Updated on  28th November

6 Min Read
Reading Time: 6 minutes

Now A days Bots are handy way to automate any communications with targeted audience. Bots are able to send alerts, notifications in real time. Luckily Cloudways is offering an intelligent CloudwaysBot which is a very smart assistant for yur server and apps hosted on Cloudways. The CloudwaysBot sends you the notifications and integerate with many applications.


In this article, I will demonstrate how to collect all notifications (new and old) from the CloudwaysBot and send them to a Trello project as an individual task.

Send CloudwaysBot Alerts

To send CloudwaysBot alerts as task in Trello, I will setup a webhook in CloudwaysBot. But before that, I will add the code to get the response of the webhook.

This is a simple code snippet that will get the CloudwaysBot response and save it in $text.

Start Building With Trello

The first step is to get the Application Key that identify the API and authenticate API calls.

Application Key

Here is how you get the key

Developer Key

Setup the Webhook in CloudwaysBot

CloudwaysBot supports custom APIs and I will now create a webhook for the index.php file. I will use the the staging URL that is located in the Application Access Details tab.

Go to CloudwaysBot from the top navigation menu, click on the channels tab and then click the Add Channel button.

Select the API option from the drop down list.

Enter the complete URL of the index.php, set the Name of the channel and the status to Active.

Include Client Library and jQuery

The next step is the inclusion of jQuery and client.js in the application. Before the body tag, add the following code and replace the AppKey. When you add this code to the page, a global Trello object (with several important methods) becomes available. In addition, by specifying the Application Key in the URL for client.js, I can automatically use it when making requests.

Now, that these two dependencies have been included , I can access a global Trello object.

Receive User Token

There are two ways to authorize a client and receive a User Token. The first is through the authorize route while the second is the basic OAuth. The default parameter is redirect. This decides whether authorization should be done in a new window, or by leaving the current page.


The name of the application, which is displayed during the authorization process.


true or false. The default parameter is true, in which case, the token is saved to the local storage.


true or false. The default parameter is true. In the case of false, the stored token is used instead of redirection or other methods.  


Object like { read: allowRead, write: allowWrite, account: allowAccount }

The default value is read-only, i.e. { read: true, write: false, account: false }

Each permission is a boolean variable.


1hour, 1day, 30days ,never

The default duration of token expiration is 30days.


Optional function to be called in the event of success.


Optional function to be called in the event of error.

If using type: “redirect”, the token will be returned to the current location.href. When it is returned, call authorize with interactive: false to get the token.

Authenticate User

It’s important to understand that the Authentication Token gives the application the ability to make calls on behalf of the user, from their context. This token grants access to the authenticated user’s Boards, Lists, Cards, and other settings, depending on the permissions requested in the authenticate method.

Define Success and Failure

First, let’s define what happens when authentication has finished, using success and failure callbacks.

Use php client for consuming the Trello API


Via Composer

By using this, you could:

  • Configure client
  • Authenticate user and retrieve access token
  • Access API

Configuration Creating Client

Multiple Configuration After Creating Client

Single configuration after creating client

Authenticate User Access Token

The Trello client allows you to assist walking the users through the OAuth authorization process and provide application access token credentials. This package utilizes The League’s OAuth1 Trello Client to provide this assistance.

OAuth 1 Client is an OAuth library for authentication at OAuth 1 servers.

Install Via Composer

Use the Client Through the Following Code

This is often required when the user is redirected back. This involves retrieving token credentials, which could then be used to make calls to the server on behalf of the user. These calls were referred to as  access tokens in earlier versions of OAuth 1.

you  can check these by:

Access User Information

Now that token credentials are available, I could use them to make calls against the server, as an authenticated user.

User Authentication and Store Access Token

Application’s Required OAuth Settings

Get Authorization URL, Then Redirect the User

Authorization Token for Access Token

After the user approves or denies access to the application, they are redirected to the provided callback URL. If the user approves access, the URL will include oauth_token and oauth_verifier in query string parameters.

Use Access Token to Make Requests

Access the API With Access Token

Exceptions Handling

The above code sends CloudwaysBot notifications to Trello. Previously, I used $getalerts to fetch the alerts and var_dump to view the results. To send new alerts and avoid duplications, I will compare the current date of the server with the date of alerts, and then finally, create a task for the respective alert.

This process could be automated through a cron job. Here is a handy tutorial on how to create and setup the cron job.


In this article, I discussed how you could add CloudwaysBot notifications in a Trello project through CloudwaysBot API. If you have a question about the process or would like to contribute to the discussion, leave a comment below.

Share your opinion in the comment section. COMMENT NOW

Owais Alam

is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform and a seasoned PHP developer. He loves to develop all sorts of websites on WordPress and is in love with WooCommerce in particular. You can email him at

Start Growing with Cloudways Today.

Our Clients Love us because we never compromise on these

Get Our Newsletter
Be the first to get the latest updates and tutorials.