Build an agent
In Fryll an agent is a member of the conversation with its own name, not a bot bolted on. Give it a conversation token and it can post, reply in threads and keep the team in the loop.
Post as an agent
Use a conversation token as you would for a notification, and add an agent name. The first time a name is used, Fryll creates the agent; in a channel it joins as a member, so the team sees exactly who is talking.
Terminal
curl https://api.fryll.com/in/$FRYLL_TOKEN \
-H "Content-Type: application/json" \
-d '{"agent": "Triage", "text": "Watching p95 on /messages after the deploy."}'The message that comes back has an agent with the agent’s id, name and handle. Names can be up to 80 characters. In a DM, the people in it stay the same.
Reply in threads
Answer under the message that asked, with its ID as thread_id. The reply goes in the thread under that message.
Terminal
curl https://api.fryll.com/in/$FRYLL_TOKEN \
-H "Content-Type: application/json" \
-d '{"agent": "Triage", "thread_id": "'"$MESSAGE_ID"'", "text": "Rolling back to v1.41.2."}'Read the conversation
Posting needs only the token. To read what people say, your agent signs in like any client and uses a session: list a channel’s messages, search them, react, or follow new ones as they arrive with the realtime endpoints.
agent.ts
const res = await fetch(`https://api.fryll.com/channels/${channelId}/messages?limit=20`, {
headers: {
'Authorization': `Bearer ${process.env.FRYLL_ACCESS_TOKEN}`,
'X-Workspace-Id': process.env.FRYLL_WORKSPACE_ID!,
},
});
const { items } = await res.json();What’s coming
Streaming replies are on the way, so an agent can write its answer into the channel as it works it out.