Skip to content

Developer SDKs ​

The power of the Logic Runtime is made accessible through our language-specific Software Development Kits (SDKs). These SDKs provide a simple, idiomatic interface to the platform's capabilities, allowing developers to focus on business logic instead of low-level WASM plumbing.

We provide first-class support for today's most powerful languages.

TypeScript SDK ​

Our TypeScript SDK provides a familiar, ergonomic API for JavaScript and TypeScript developers. It is ideal for building fast, type-safe backend Actions that respond to platform events.

The following Action could be triggered when a new "urgent" task is created. It queries for the task details and the assignee's name, then sends a notification to a Slack channel.

typescript
// file: notify_urgent_task.ts

import type { Request } from '@simple/sdk'

import simple from '@simple/sdk'
import { query as gqlQuery } from '@simple/sdk/graphql'
import { post as httpPost } from '@simple/sdk/http'

// Define the shape of our GraphQL query result
interface TaskQueryResult {
  task: {
    assignee: {
      name: string
    }
    title: string
  }
}

// Define the shape of the incoming trigger payload
interface TriggerPayload {
  recordId: string
}

simple.Handle(async (req: Request) => {
  const { recordId } = req.parse<TriggerPayload>()
  const { context } = req

  // 1. Fetch more details about the task and its assignee using GraphQL
  const taskData = await gqlQuery<TaskQueryResult>(
    `query getTaskDetails($id: ID!) {
      task(id: $id) {
        title
        assignee {
          name
        }
      }
    }`,
    { id: recordId },
    context,
  )

  if (!taskData?.task) {
    console.error(`Task with ID ${recordId} not found.`)
    return
  }

  // 2. Construct a message and send it to a Slack webhook
  const { assignee, title } = taskData.task
  const slackMessage = `🚨 Urgent Task Created: "${title}" has been assigned to ${assignee.name}.`

  // (The Slack webhook URL would typically come from a secure setting)
  const SLACK_WEBHOOK_URL = 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'

  await httpPost(SLACK_WEBHOOK_URL, { text: slackMessage }, {}, context)
})

Go SDK ​

For high-performance logic, our Go SDK provides a robust, statically-typed development experience. It's perfect for building complex, data-intensive Actions that demand maximum performance.

The Go Action below handles a request to sync an invoice, updating its status in the database via a GraphQL mutation.

go
// file: sync_invoice.go

package main

import (
	"simple.dev/sdks/go/simple"
	"simple.dev/sdks/go/simple/graphql"
)

func main() {
	simple.Handle(syncInvoice)
}

// Action to sync an invoice and update its status
func syncInvoice(req simple.Request) (any, error) {
	ctx := &req.Context

	var input struct {
		Record struct {
      ID string `json:"id"`
    } `json:"record"`
	}

	if err := req.Parse(&input); err != nil {
		return nil, err
	}

	// Update the invoice's sync_status in the database
	variables := map[string]any{
		"id":     input.Record.ID,
		"object": map[string]string{"sync_status": "Success"},
	}

	_, err := graphql.Mutate(
		`mutation update_sync_status($id: ID!, $object: JSON!) {
			invoice: update_com_simple_construction_project_management__invoice(
				_set: $object, id: $id
			) {
				id
			}
		}`,
		variables,
		ctx,
	)

	return nil, err
}

Coming Soon: Python SDK

We are actively developing a Python SDK to bring the power and simplicity of the platform to the world's most popular language for data science and AI.

Next Step ​

An Action is only useful when it runs. Learn about the different events that can trigger your logic.

→ Triggering Your Logic