examples/ has two files: webhook.ts, a synthetic feed through the runtime, and
serverless.ts, driving the core from a stateless handler. Both show the mechanism.
Neither shows a real channel.
The first question somebody has after the README is what this looks like against an
actual API. An example that answers it end to end would show:
- a webhook handler calling
runtime.ingest({ conversationId, messageId, text }) with
the ids the channel gives it
runtime.typing({ conversationId }) fed from the channel's composing event, which is
the whole point of that feature
- a
turn handler sending one reply back
WhatsApp Cloud API and Telegram are both reasonable targets. Telegram is easier to try
without a business account.
What it has to keep
- No new dependencies.
fetch is in Node 20 and that is all either API takes.
- Readable without credentials. Somebody should learn the shape by reading the file
without signing up for anything, so the token comes from an environment variable and
the file says what it expects.
- Name the API version it was written against, and keep it in
examples/, which is not
part of the published package.
examples/has two files:webhook.ts, a synthetic feed through the runtime, andserverless.ts, driving the core from a stateless handler. Both show the mechanism.Neither shows a real channel.
The first question somebody has after the README is what this looks like against an
actual API. An example that answers it end to end would show:
runtime.ingest({ conversationId, messageId, text })withthe ids the channel gives it
runtime.typing({ conversationId })fed from the channel's composing event, which isthe whole point of that feature
turnhandler sending one reply backWhatsApp Cloud API and Telegram are both reasonable targets. Telegram is easier to try
without a business account.
What it has to keep
fetchis in Node 20 and that is all either API takes.without signing up for anything, so the token comes from an environment variable and
the file says what it expects.
examples/, which is notpart of the published package.