Embedded Elixir templates for chat apps.
This is a YET TO BE DEVELOPED idea for developing a templating dsl for chat apps using Elixir's EEx SmartEngine.
The idea is to support multiple chat app platforms. The following come to mind as inclusive to the initial releases:
- Slack
- Discord
- Microsoft Teams
- Amazon Alexa
- SMS
I am unsure if it is possible to define one language dsl for all but I do know that exceptions will have to be made. I am think at the very best, you could have a "ChEEx DSL" and then have exceptions for each platform, similar to something like React Native. I think it would be wise to see how it looks for various platforms and then see if there are enough commonalities to create a common engine.
Support would look like having files for different platforms, e.g. welcome_message.slack.cheex
and welcome_message.discord.cheex
.
There could be support for multiple platforms within one template. The file would be welcome_message.cheex
and would have the following content:
<%= :slack do %>
<%= render slack/section text=<%= welcome_message %> %>
<% end %>
<%= :teams do %>
<%= render teams/card body=<%= welcome_message %> %>
<% end %>
Even "partials" could have platform-specific files. So calling this: <%= render "welcome_message" %>
would render _welcome_message.slack.cheex
on Slack and _welcome_message.teams.cheex
on Microsoft Teams.
In order to get the initial templating engine running, I believe cheex should implement basic Slack component support using either a rudimentary library? I propose it supports the current blockkit with partials using an existing Phoenix templating (or similar library).
You should be able to get started with the following:
<section text="This is awesome!" />
<section text="It will automatically detect :emoji:" />
<section text="As well as *mark down*" />
<section text="As well as *mark down*">
<accessory>
<datepicker initial_date={@initia_date} />
</accessory>
</section>
<section>
<field text="" />
</section>
- Clone the repository
git clone https://github.com/juvet/cheex
- Create a feature branch
git checkout -b my-awesome-feature
- Codez!
- Commit your changes (small commits please)
- Push your new branch
git push origin my-awesome-feature
- Create a pull request
gh pr create --head octocat:my-awesome-feature
Copyright (c) 2022, Jamie Wright.