Engineer Blog – Creating a Discord BOT (Free 24/7 Operation)

I introduce the learning topics I’m working on daily in my engineer blog. Recently, I personally created a Discord bot and successfully ran it for free, 24/7, so I’d like to share that experience with you this time.

What’s Discord?

Before diving into the main topic, let me give a brief overview of Discord. Discord is a communication service developed in the United States that supports text, voice, and video interactions. I mainly use it as a call app while working.

Here are the main features of Discord (only those relevant to the main topic have been extracted)

◆ Server
A server is a feature similar to group chats, allowing multiple users to interact through text chats and voice communication. Servers are categorized into Open Servers (which can be made publicly available through application, searchable within Discord, or announced on bulletin sites for recruiting members) and Private Servers (accessible only by invitation unless applied for).

◆ Text
Channel This is a group chat feature within a server where members can communicate with each other through text.

◆ Voice
Channel This is a group call feature within a server, allowing members in the channel to communicate and share their screens.

◆ BOT
By introducing a BOT, you can enhance the functionality of your server. Inviting publicly available BOTs allows you to add useful features like music playback, text-to-speech, timers, and schedule management. You can also invite and operate your own custom-made BOT.

From Creating to Operating a BOT

The BOT I created this time is a ‘Voice Channel Entry Notification BOT’ for private servers.

◆ Inspiration
In Discord, when someone enters a voice channel, there is no built-in feature to notify other server members. As a result, someone might be waiting without realizing they’re working alone. That’s when I thought, ‘Wouldn’t it be useful to have a BOT that sends notifications for channel entries?’ And so, I decided to create one.

◆ Implementation Details
①Determine the BOT’s features and coding
Create a main.js file in JavaScript to align with sites that allow free 24/7 BOT operation.

Features included:

  • When the number of users in the ‘Working’ voice channel changes from 0 to 1, automatically send a recruitment message to the ‘Call Recruitment (Auto)’ text channel.
  • If the number drops from 1 to 0, delete the recruitment messages previously sent to ‘Call Recruitment (Auto)’ entirely.
  • From 1 to 2 or more users, no recruitment messages are sent to ‘Call Recruitment (Auto)’.

Below is part of the actual coding.

② Create a BOT Account on Discord Developer Portal
Access the Discord Developer Portal, create a BOT account from ‘New Application,’ and obtain the token.

Enable the following in the BOT’s permission settings.

After configuring the BOT’s permissions, invite the BOT to your server using the generated URL.

③ Create a Repository on GitHub and Upload the Source Code
I used Git, which I’ve previously introduced on my engineer blog and discussed during an internal workshop.
Create a repository on GitHub and upload the source code.

④ Link Deno.deploy with GitHub and Log In
Create a project in Deno.deploy and import the repository created on GitHub.
Set the token obtained in step ② as an environment variable.

⑤ Add Deno.cron at the End of the Source Code to Enable 24/7 Operation
To ensure the BOT doesn’t stop, add a periodic process (Cron job) at the end of the source code that performs light operations every 2 minutes on Deno.deploy..
This allows the BOT to operate 24/7.

⑥ Test on the Discord Server
Enter the voice channel and check if it operates as expected.

When the voice channel has no members, the text channel has no messages.
When you join the voice channel and the number of members in the voice channel changes from 0 to 1, a call recruitment message is sent to the text channel.
When you leave the voice channel and the number of members in the voice channel decreases from 1 to 0, the message in the text channel is automatically deleted.

It has been confirmed to be working as expected, so it will be completed once the BOT is checked to ensure it is not offline the next morning.

That wraps up the discussion on creating a Discord BOT and achieving free 24-hour operation.

Stay tuned for the next technical blog

技術者ブログ-Discord BOT作成(無料での24時間稼働まで)

技術者ブログとして日ごろ取り組んでいる学習内容を紹介します。
最近個人的にDiscordのBOTを作成し、無料での24時間稼働に成功したので今回はそちらについてご紹介します。

Discordとは

本題に入る前に、まずDiscordについて簡単に説明します。
Discordはアメリカで開発されたテキスト・ボイス・ビデオでコミュニケーションが取れるサービスです。
私は主に作業時の通話アプリとして利用しています。

Discordの主な機能は以下のとおりです。(本題に関係する部分のみ抜粋します)

◆サーバー
サーバーとはグループチャットのような機能です。複数のユーザーとテキストチャットや音声でやり取りができます。
サーバーには オープンサーバー(申請してDiscord内検索や掲示板サイトでサーバーを公開し、メンバー募集できる)と、プライベートサーバー(申請しない限り招待制で利用する)があります。

◆テキストチャンネル
サーバー内のグループチャット機能です。メンバー同士でテキストのやり取りができます。

◆ボイスチャンネル
サーバー内のグループ通話機能です。入室したメンバー同士で会話や画面共有ができます。

◆BOT
BOTを導入すると、サーバーの機能を拡張できます。公開されているBOTを招待すれば、音楽再生・テキスト読み上げ・タイマー・予定調整など、便利な機能を追加できます。
また、自作BOTを招待して動かすことも可能です。

BOT作成から稼働まで

今回作成したのは、プライベートサーバー向けの 「ボイスチャンネル入室通知BOT」 です。

◆きっかけ
Discordでは、ボイスチャンネルに入室してもサーバーメンバーに通知が行かない仕様のため、誰かが待機していても気付かずに一人で作業してしまうことがありました。
そこで「入室を通知してくれるBOTがあれば便利なのでは」と考え、作成することにしました。

◆実施内容
①BOTの機能を決めてコーディング
BOTを24時間無料で稼働させることができるサイトに合わせて、JavaScriptでmain.jsファイルを作成します。

機能としては以下を入れています。
・「作業中」ボイスチャンネル内の人数が0人から1人になった時のみ「通話募集(自動)」テキストチャンネルに通話募集のメッセージ送信
・1人から0人になったら「通話募集(自動)」に送信されていた通話募集メッセージを全削除
・1人から2人以降は「通話募集(自動)」に通話募集のメッセージを送信しない

以下は実際のコーディングの一部です。

②Discord Developer PortalにBOTアカウントを作成
Discord Developer Portalにアクセスし、New ApplicationからBOTアカウントを作成し、トークンを取得します。

BOTの権限設定で以下を有効にします。

BOTの権限を設定したら生成されたURLからBOTをサーバーに招待します。

③GitHubにリポジトリを作成し、ソースをアップロード
以前技術者ブログでも紹介したことがあり、社内勉強会でも触ったことのあるGitを使用しました。
GitHubにリポジトリ作成をしてソースをアップロードします。

④Deno.deployとGitHubを連携してログイン
Deno.deployの中でプロジェクトを作成し、GitHubで作成したリポジトリをインポートします。
②で取得したトークンをEnvironment variablesに設定します。

⑤ソースの最後の方にDeno.cronを記載し、24時間稼働させる
BOTが止まらないように2分ごとにDeno.deploy上で軽く動作させるための定期処理(Cronジョブ)をソースの最後の方に記載します。
これで24時間BOTが稼働してくれるようになります。

⑥Discordサーバーでテスト
実際にボイスチャンネルに入室して想定通りに動くか確認します。

ボイスチャンネルに0人の状態。テキストチャンネルにはメッセージがない状態です。
ボイスチャンネルに入室してボイスチャンネルの人数が0人から1人になるとテキストチャンネルに通話募集のメッセージが送信されます。
ボイスチャンネルから抜けて、ボイスチャンネル内の人数が1人から0人になるとテキストチャンネルのメッセージが自動で削除されます。

想定通りに動くことが確認できたので、翌朝BOTがオフラインになってないか確認したら完了です。

以上、長くなってしまいましたが、DiscordのBOT作成から無料での24時間稼働まででした。

次回の技術者ブログをお楽しみに。

Employee Introduction

Thank you for reading.
My name is OZ, and I will be writing this employee introduction article.
I will talk about what led me to join Dandelions and my impressions since joining the company.

What led me to join

I first learned about this company at a career fair held at my university.
I had always been interested in the IT industry, and while searching for IT-related companies among the many companies participating in the fair, I happened to notice this company. When I spoke with them at their booth, I was attracted not only by the content of their presentation but also by the warmth conveyed by the expressions and manner of speaking of their employees. I decided without hesitation to apply for an internship at this company.
During the internship, I had the opportunity to experience actual work while interacting with the employees, and I was strongly drawn to their personalities and the workplace atmosphere. Given my existing interest in the IT industry, the desire to work for this company naturally solidified over time.

Impressions after joining

The first thing I noticed when I joined the company was how supportive everyone was.
I started my career as a new graduate with no idea what I was doing, but my seniors guided me patiently, allowing me to take each step forward with confidence.
What stands out most in my memory is the programming training. The curriculum covered the basics thoroughly, and there was an atmosphere where I could ask questions whenever I didn’t understand something. Thanks to the guidance tailored to my pace, I was able to deepen my understanding without feeling rushed.
Additionally, in the business etiquette training, I learned the basics of being a professional, such as how to handle phone calls, write emails, and exchange business cards. The words of a senior colleague, “Everyone starts as a beginner, so it’s okay,” still serve as a source of encouragement for me.
In this supportive environment, I can feel myself growing little by little, and my belief that “joining this company was the right choice” grows stronger each day.

About me

My hobbies include gaming and sports, especially bowling and soccer. Recently, I have been focusing on strength training, with the goal of gaining 5 kg. I also love exploring new ramen restaurants, and when I have time, I enjoy searching for new places to try.
Although I am still new to the workforce, I aim to grow by learning new things every day.

One of the best ramen dishes I’ve ever eaten.

That’s all for this time.
Stay tuned for the next employee introduction!

社員紹介  

ご覧いただき、ありがとうございます。
今回社員紹介の記事を担当します、「OZ」です。
ダンデライオンズに入社したきっかけ・入社した感想についてお話します。

入社のきっかけ

私がこの会社を知ったのは、大学で行われた企業説明会がきっかけでした。
もともとIT業界に興味があり、たくさんの企業が並ぶ中IT関連の企業を探していた時に、ふと目に留まったのが今の会社です。ブースでお話を伺ったとき、説明内容はもちろん、社員の方々の表情や話し方から伝わる温かさに魅力を感じ、この会社のインターンシップに参加したいと思い、迷わず応募しました。
インターンシップでは、実際の仕事を体験しながら社員の皆さんと関わることができ、その人柄や職場の雰囲気に強く惹かれました。もともとIT業界に興味があったこともあり、「この会社で働きたい」という気持ちが自然と固まっていきました。

入社後の感想

入社してまず感じたのは、「サポートがとても手厚い」ということです。
右も左も分からない状態で社会人生活が始まりましたが、先輩方が丁寧に指導してくださり、安心して一歩ずつ前進できました。
特に印象に残っているのは、プログラミング研修です。基礎からしっかりと学べるカリキュラムがあり、分からないことがあればすぐ質問できる雰囲気がありました。自分のペースに合わせた指導のおかげで、焦らず理解を深めることができました。
また、ビジネスマナー研修では、電話対応やメールの書き方、名刺交換の方法など、社会人として必要な基本を一つひとつ学びました。「最初は誰でも初心者だから大丈夫」という先輩の言葉は、今も心の支えになっています。
こうした恵まれた環境の中で、少しずつ成長できている自分を実感し、「この会社に入ってよかった」という思いが日々強くなっています。

自己紹介

私の趣味はゲームや運動で、特にボーリングやサッカーが好きです。最近は筋トレにも力を入れていて、目標は体重を5kg増やすことです。そして、美味しいラーメン巡りも大好きで、時間があるときには新しいお店を探すこともあります。
まだ社会人としては駆け出しですが、日々新しいことを学びながら成長していきたいと思います。

今まで食べた中でも上位に食い込むラーメン

今回は以上となります。
次回の社員紹介もお楽しみに!

New Employee Social Event

Hello, I’m Pudding🍮 from Team 1!
This time, I’d like to talk about my impressions of going to Higashiyama Zoo and Botanical Gardens with four of my coworkers.

We went to Higashiyama Zoo and Botanical Gardens.
We gathered at Higashiyama Zoo and Botanical Gardens at 11am and started exploring.
We looked at various animals, including Asian elephants, koalas, the recently visited Komodo dragon, and lions. However, it started to rain halfway through, so it’s a bit disappointing that we weren’t blessed with good weather.
This time, we had three missions to go around the zoo.

  1. Make friends with all the coworkers!
  2. Find animal sponsorship signs!
  3. Look at the zoo from the perspective of IT!
    These are the three. We went around trying to achieve these.
    As a break, we all rode duck boats. In the end, we had to pedal the boat, so even though it was a break, we were quite exhausted. We also went up the Sky Tower and saw the whole zoo. To be honest, I’m not good with heights, so I was really scared to go up in the elevator with a view outside. 😭 I think I was able to get along better with my coworkers through various activities!

We found the animal sponsorship sign!
Our company sponsors lions. We found the animal sponsorship sign and took a photo together! On this day, the male lion “Regulus” was outside. He had a bigger body than I expected, a bushy mane 🦁, and was very cool!
Currently, lions are designated as Vulnerable (VU) on the Red List. This means that the species is likely to become extinct in the wild. Perhaps in the future we will no longer be able to see lions. That’s why I felt that the actions of each of us now are very important. I hope that we will continue our sponsorship activities.

Let’s look at the zoo from the perspective of IT!
At the entrance gate, I saw staff members who looked like they were having a hard time tearing off paper tickets one by one to check them and handing out re-entry papers. So, I thought that if we could introduce QR code tickets and manage entrances, exits, and re-entries, it might help improve work efficiency.

Not only did I enjoy the zoo, but I was able to make new discoveries by looking at it from a different perspective. I want to keep this way of thinking in mind as I work in the future. I hope I can enrich people’s lives.

Summary
By visiting the zoo this time, I was able to deepen my bonds with my fellow employees and learn about the animal sponsorships that our company does. It was also interesting to see the zoo from a different perspective and make new discoveries. I hope I can use this experience to work hard in my future work!

That’s all for now.
Thank you for reading this far.
Stay tuned for the next one!

新入社員親睦イベント

こんにちは、チーム1所属の「プリン🍮」です!
今回は同期の4人で東山動植物園に行ってきた感想についてお話ししたいと思います。

東山動植物園に行きました。

私たちは、11時に東山動植物園に集合し探索を開始しました。
アジアゾウやコアラ、最近来園し話題のコモドオオトカゲ、ライオンなどいろいろな動物を見て回りました。しかし、途中からあいにくの雨、、、天気に恵まれなかったのは少し残念です。
そして今回動物園を回るときのミッションが3つありました。
①同期のみんなと仲良くなること!
②動物スポンサー看板を見つけること!
③動物園をIT化する視点から見てみること!
この3つです。しっかりこれらを達成できるように回ってきました。
途中休憩として、みんなでアヒルボートに乗りました。結局ペダルでボートを漕がなきゃいけないので、休憩と言いながら結構体力を消耗しました。そして、スカイタワーものぼり、園全体を見ました。正直私は高いところが苦手なので、外が見えるエレベーターで上にのぼっていくのはほんとに怖かったです😭いろいろなアクティビティを通して同期のみんなとより仲良くなることができたと思います!

動物スポンサー看板を発見!

当社はライオンの動物スポンサーをしています。動物スポンサーの看板を見つけて、みんなで写真を撮りました!そしてこの日は雄ライオンの「レグルス」がお外に出ていました。思っていたより大きい体、ふさふさのたてがみ🦁、とってもかっこよかったです!
現在、ライオンはレッドリストの絶滅危惧Ⅱ類(VU)に指定されています。これはその種が野生で絶滅する可能性が高いことを表しています。もしかしたら、将来ライオンが見れなくなる時代が来るかもしれません。だからこそ、今、私たち一人ひとりの行動がとても大切だと感じました。ぜひスポンサー活動をこれからも続けてほしいと思います。

動物園をIT化する視点で見てみよう!

入園ゲートで紙チケットを一枚一枚ちぎって確認したり、再入園の紙を配ったり、大変そうなスタッフさんを見かけました。そこでQRコードのチケットを導入して入退場や再入場を管理出来たら仕事の効率が少しでも上がるんじゃないかなと感じました。
ただ動物園を楽しむだけでなく、違う視点から見ることで新しい発見をするこができました。これから仕事をしていく上でもこのような考え方を大切にしていきたいです。そして、人々を豊かにしていけたらいいなと思います。

まとめ

今回動物園を回って、同期のみんなとも絆を深めることもでき、当社の行っている動物スポンサーについても知ることができました。また、違う視点から考える動物園も新たな発見があって面白かったです。ぜひこの経験を生かして今後の仕事に励んでいけたらいいなと思います!

今回は以上になります。
ここまで読んでくださり、ありがとうございました。
次回もお楽しみに!

Grooming Training 2025

Hello! This time, we four new employees who joined the company in spring 2025 would like to introduce the “grooming training” that was held the other day.
This training was taught by Ms. Moriuchi of Brilliant Impression.

Classroom
In the classroom, we learned about the basics of clothing (suits and office casual) and how to look clean. In the basics of clothing, we learned the importance of dressing appropriately for the time, place, and occasion, such as color combinations, size, and choosing materials according to the season. In the clean appearance, we realized the importance of being aware that “every little detail is being looked at,” including hairstyle, nail length, and shoe care.
Before starting work as a member of society, it was a valuable opportunity to learn “how to improve my impression” and “what points to pay attention to.”

Fabric Selection
After the classroom, we all went to “KASHIYAMA Melsa Sakae Store” to make custom suits.
While checking the texture and design of the fabrics on site, we chose the ones that best suited us one by one. Not only the fabric, but also the silhouette of the jacket, the type and number of buttons, and other details can be customized, and there were times when we were troubled by the large number of options. At that time, we were able to make a decision while referring to advice from Mr. Moriuchi and the knowledge we gained in the classroom.
Everyone successfully completed the order, and all that was left was to wait for the suit to be completed!

Fitting
A few weeks after choosing the fabric, buttons, and lining, the suit was completed and six of us, including us, went for a fitting. When we saw the finished suits of everyone, we were surprised that “the same suit can be so different.” Some people had plain dark blue, some had navy blue stripes, and some had changed the buttons to buffalo and played around with the color of the lining, and each person’s personality could be felt from the suit, and it felt like there were “six correct answers.” It was a good experience that gave us a chance to think a little about our own style through choosing a suit. It was fun to see the finished custom-made suit, and we discovered that it was a suit we chose ourselves, so it was motivating.
And here are our before and after photos!

Before
After

Summary
Through this training, we were able to once again recognize the importance of first impressions for working adults.
I learned that small daily considerations like clothing, hairstyle, and shoe care are directly connected to trust and cleanliness, and I became more conscious of my appearance.
The practical experience of making a custom suit also provided me with a valuable opportunity to think about my own style. Each completed suit clearly reflected my individuality, and I realized that there is no single right answer.
I would like to use this experience to become more aware of my responsibilities as a working member of society and approach my future work with a positive attitude.

Thank you for reading this far!
Please look forward to the next blog!

身だしなみ研修 2025年度について

こんにちは!今回は2025年春に入社した私たち新入社員4人で、先日行われた「身だしなみ研修」についてご紹介したいと思います。
今回の研修は、Brilliant Impressionの森内様に講師をしていただきました。

座学

座学では服装の基本(スーツやオフィスカジュアル)、清潔感のある見た目などについて学びました。服装の基本では色の組み合わせやサイズ感、季節に合わせた素材選びなど、TPOをわきまえた装いの重要性を学び、清潔感のある見た目では髪型や爪の長さ、靴の手入れまで、「細かいところほど見られている」という意識を持つことの大切さを実感しました。
社会人として働き始める前に、「自分の印象をどのように整えるべきか」「どんな点に気をつけるべきか」を学ぶ貴重な機会となりました。

生地選び

座学後は全員でオーダースーツを作りに「KASHIYAMAメルサ栄店」へ向かいました。
現地では実際に生地の質感やデザインを確認しながら、自分たちに最も合うものを一つひとつ選んでいきました。生地だけでなく、ジャケットのシルエットやボタンの種類・数など、細部に至るまでカスタマイズが可能で、選択肢の多さに悩む場面もありました。その際は森内様からのアドバイスや座学で得た知識を参考にしながら決めることができました。
全員が無事にオーダーを終え、あとは完成を待つばかりです!

フィッティング

生地やボタン、裏地選びなどをしてから数週間後、スーツが完成し私たちを含めた6人でフィッティングに行きました。出来上がったみんなのスーツを見てみると、「同じスーツでもこんなに違いが出るのか」と驚かされました。濃紺無地の人もいれば、紺色のストライプ柄の人、水牛のボタンに変えたり裏地の色を遊んだ人もいて、それぞれの性格がスーツから感じ取れて“6通りの正解”があるような感じでした。スーツ選びを通してちょっとした自分のスタイルを考えるきっかけにもなり良い体験になりました。オーダースーツの完成品をみるのも楽しいし、自分で選んだスーツだけあってモチベーションも上がるんだなという発見もありました。
そしてこちらが私たちのビフォーアフターになります!

まとめ

今回の研修を通して、社会人にとって第一印象の重要性を改めて認識することができました。
服装、髪型、靴の手入れといった日々の小さな心がけが、信頼や清潔感に直結することを学び、身だしなみに対する意識が高まりました。
また、オーダースーツを作るという実践的な体験を通じて、自分らしいスタイルとは何かを考える貴重な時間にもなりました。完成したスーツにはそれぞれの個性がしっかりと表れており、「正解は一つではない」ということを実感しました。
今回の経験を活かし、社会人としての自覚を持ち、これからの仕事にも前向きに取り組んでいきたいと思います。

ここまでご覧いただきありがとうございます。
次回のブログをお楽しみに!

Engineer Blog: (Outsystems) Calling External APIs

Let us introduce the learning topics we work on daily as part of our engineer blog. This time, it’s Team 2, focusing on low-code development!

This time’s theme: (Outsystems) Calling External APIs

In Outsystems, there are several ways to use externally published APIs. This time, we’ll focus on introducing the method for calling REST-style APIs.

The API we will use this time

This time, we’ll use an example of calling ‘Completions,’ one of the APIs provided by OpenAI (link: API reference). It’s the API that powers ‘ChatGPT,’ enabling the functionality where users send a request and the AI responds with a written answer. Many of you might have seen or used it before, haven’t you?

Implementation Example

This time, we used this API to create a feature where AI evaluates Japanese reports submitted by users and provides feedback on the content, including assessments and suggestions for improvement.

The layout of the API execution screen

The layout is quite simple: users input text into the ‘Report Input Field’ on the left side of the screen. By pressing the ‘Evaluate’ button, evaluation results and improvement feedback are displayed in the ‘Feedback’ section on the right.

Action upon pressing the button
”GetFeedback” Action

The process upon pressing the button involves re-executing the REST API set within the Data Action. The flow includes setting parameters for the request required for API execution and then executing the API itself. So, how do you configure the API request here? By providing a sample request in Outsystems, it automatically generates the necessary configuration. Below, we’ll explain further with images.

Display the REST context menu. Here, select ‘Consume REST API…
This time, select ‘Add single method.’
A screen to configure the desired REST URL and request/response samples. Here, set up the request/body based on the API Reference provided in the previously mentioned ‘Completions’ link.
Example of Body Configuration
Example of Header Configuration
Using the body and header input details, input test data and perform a test run to confirm the request and response results. If there are no issues, press the ‘Finish’ button to automatically generate the main action and the necessary data structure for the request and response.

Once this is done, you can simply configure it as you would typically build logic in Outsystems: place the created REST API as an action in the flow, set the necessary inputs, and handle the return values to complete the API call.

Execution example: Feedback is returned for the entered report.

Summary

How was it? With the URL of a publicly available API and its reference, you can call it from Outsystems just like a regular action. However, be aware that publicly available APIs might have usage fees, limitations on the number of calls, or data capacity restrictions. So, please plan your usage carefully…

Team 2 will continue to share engineer blogs using low-code tools like Outsystems in the future, so stay tuned!

技術者ブログ:(Outsystems)外部APIを呼び出す

技術者ブログとして日ごろ取り組んでいる学習内容をご紹介します。
今回は、ローコード開発をテーマにしている第2チームです。

今回のテーマ:(Outsystems)外部APIを呼び出す

Outsystemsでは、いくつかの方法で外部公開されているAPIを利用することができます。
今回は、その中でも特にREST形式のAPIを呼び出す方法について紹介します。

今回使用するAPI

今回は、OpenAIが提供しているAPIの一つである”Completions“(リンク先:APIのリファレンス)を呼び出す場合を例として挙げます。
いわゆる”ChatGPT”が提供している、「リクエストを投げることで、AIがそのリクエストに対する回答を文章形式で返してくれる」機能を実現するためのAPIです。
皆様も一度は目にしたり、利用した経験があるのではないでしょうか?

実装例

今回は、本APIを使用して「ユーザーが入力した日本語レポートについて、AIによる評価を行わせ、内容に対する評価や改善点のフィードバックを受け取る」機能を作成しました。

API実行画面の構成

画面の構成としては至ってシンプルで、画面左の「レポート入力欄」にテキストを入力し、評価実行ボタンを押下することで、画面右の「フィードバック」欄に評価や改善点のフィードバックが表示される、といったものになります。

ボタン押下時のアクション
“GetFeedback”アクション

ボタン押下時の処理は、DataActionに設定したREST APIの再実行になります。
API実行に必要となるリクエストにパラメータを設定し、API本体を実行する、という流れです。
では、ここでどのようにAPIのリクエストを設定するのかというと、Outsystemsにリクエストのサンプルを記載してやることで自動的に生成してくれます。
以下、画像にて説明をしていきます。

RESTのコンテキストメニューを表示。ここで”Consume REST API…”を選択。
今回は”Add single method”を選択します。
呼び出したいRESTのURL、およびリクエスト/レスポンスのサンプルを設定する画面。
ここに先述の”Completions”リンクに記載のAPI Referenceを参考に、リクエスト/ボディを設定する。
ボディの設定例
ヘッダの設定例
ボディ・ヘッダの入力内容を元に、テストデータを入力してテスト実行することで、リクエスト・レスポンスのテスト結果を確認できる。
内容に問題が無ければ”Finish”ボタンを押下することでアクション本体、およびリクエスト・レスポンスに必要なデータ型(Structure)が自動生成される。

ここまでできれば、後は通常のOutsystemsでロジックを組む場合と同様に、作成されたREST APIをアクションとしてフローに配置し、必要なインプットを設定、戻り値を処理するだけで呼び出しが実現できます。

実行例。入力したレポートに対するフィードバックが返されている。

まとめ

いかがでしたでしょうか?
実際に公開されているAPIのURLと、APIのリファレンスがあれば、このようにOutsystemsから通常のアクションと同じように呼び出すことができます。
ただし、一般に公開されているAPIについては使用料金を設定していたり、回数や容量に制限を設けていたりする場合があります。
くれぐれもご利用は計画的に…。

第2チームでは、これからもOutSystemsなどのローコードツールを使った技術者ブログを展開していきますのでお楽しみに!