Service: Contact Form Service - EyevinnOSC/community GitHub Wiki

Contact Form Service

Contact Form Service (serviceId birme-contact-form-svc) is a Docker-ready backend that receives contact form submissions from a website and forwards them to Slack. In Eyevinn Open Source Cloud (OSC) it is a long-running service instance. License: MIT. Source: birme/contact-form-svc.

What it can do

  • Accept contact form submissions (JSON or HTML form POST) at /contact and forward them to a Slack channel.
  • Sit in front of any static site or web app to give lead notifications without writing a custom backend.
  • Run with a dummy transport that only logs to the console, for testing.

Creating an instance

For the slack transport you need a Slack bot:

  1. Create an app at api.slack.com/apps.
  2. Under OAuth & Permissions add the chat:write scope and install the app to your workspace.
  3. Copy the Bot User OAuth Token (starts with xoxb-) and invite the bot to the target channel.

Store the token as a service secret with create-service-secret (serviceId: "birme-contact-form-svc", name slacktoken). Then call create-service-instance with serviceId: "birme-contact-form-svc":

{
  "name": "mycontact",
  "Transport": "slack",
  "SlackBotToken": "{{secrets.slacktoken}}",
  "SlackChannelId": "C0XXXXXXX"
}

Wait with wait-for-service-ready (or get-instance-status) and read the instance URL with describe-service-instance. The service has no OSC service dependencies.

Options

Option Required Type Meaning
name Yes string Name of the instance. Alphanumeric/word characters only (^\w+$), at most 20 characters.
Transport Yes enum: dummy, slack Where submissions are delivered. slack forwards them to Slack; dummy only logs to the console (for testing).
SlackBotToken No string, sensitive Slack Bot User OAuth Token (xoxb-...). Needed for the slack transport. Pass as {{secrets.NAME}}.
SlackChannelId No string ID of the Slack channel to post to, for example C0XXXXXXX. Needed for the slack transport.

A {{secrets.NAME}} reference must be the whole field value.

Using the instance

Send a test submission:

curl -X POST https://<instance-url>/contact \
  -H "Content-Type: application/json" \
  -d '{"name": "Alice", "email": "[email protected]", "message": "Hello!"}'

A 200 response means the message was accepted; with the slack transport it appears in the configured channel.

Point an HTML form at the service:

<form method="POST" action="https://<instance-url>/contact">
  <input name="name" placeholder="Your name" required />
  <input name="email" type="email" placeholder="Email" required />
  <textarea name="message" placeholder="Message" required></textarea>
  <button type="submit">Send</button>
</form>

Or submit from JavaScript:

await fetch('https://<instance-url>/contact', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ name, email, message }),
});

OSC CLI:

# With Slack transport
osc create birme-contact-form-svc mycontact \
  -o Transport="slack" \
  -o SlackBotToken="{{secrets.slacktoken}}" \
  -o SlackChannelId="C0XXXXXXX"

# Dummy transport (for testing)
osc create birme-contact-form-svc mycontact -o Transport="dummy"

Limitations

  • OSC puts an authentication gate in front of instance URLs except / unless the service defines public paths, so check from a browser or website that /contact is reachable by your form's visitors.

Resources

⚠️ **GitHub.com Fallback** ⚠️