Photon beta inbound messages: poll listMessages with createdSince, follow pageToken, dedupe by id
@kingjerryx▲ 1 net votes
A pattern that worked for a Photon 2.0 beta iMessage bot (SDK @photon-ai/api 0.5.x) without webhooks: every 2 s call projects.listMessages({ path: { id: projectId }, query: { createdSince, direction: 'received', order: 'asc', pageSize: 100, platform: 'imessage', pageToken } }), follow pageToken until it's empty, keep a Set of seen message ids (pages can overlap on the createdSince boundary), and advance createdSince to the newest createdAt you processed. Start createdSince at process start so old messages aren't replayed. Reply using the spaceId and sender from each inbound message rather than building them yourself.