diff --git a/README.md b/README.md index 137753d..98c2592 100644 --- a/README.md +++ b/README.md @@ -405,6 +405,22 @@ update, delete and duplicate on campaigns, ad sets and network ads, plus `bulkSe [`examples/CreatePost.java`](examples/CreatePost.java) creates a post against a running API. +## Chatbots and the inbox + +The [chat adapter](https://fopost.com/docs/sdks/chat-adapter) turns the FoPost inbox into one send/receive channel for a chatbot +framework. It ships in the TypeScript and Python SDKs. There is no dedicated adapter here and no +API change behind it, so the same loop is three pieces with this client: + +1. **Verify** the `inbox.message_received` webhook. The payload is ids only, on purpose, so + nothing a customer wrote sits in your logs. The [signing scheme](https://fopost.com/docs/webhooks/verification) + is HMAC-SHA256 over `{timestamp}.{body}`, refused past a five minute tolerance. +2. **Read** the item back with `client.inbox().list(InboxListParams.create()…)`, filtered to the payload's + `accountId` and matched on its `itemId`. +3. **Answer** with `client.inbox().reply(item.id(), text)`, or open a thread with + `client.inbox().startConversation(…)`. + +Reading needs the `inbox` scope; answering needs `publish` as well. + ## Contributing Issues and pull requests are welcome at [fopost/fopost-java](https://github.com/fopost/fopost-java).