client.FollowUps
Chaque méthode de cet espace de noms : sa signature, ses paramètres, ce qu'elle retourne et un exemple.
Méthodes
Reminders on mail you sent: ask for a thread to come back to the top of the inbox if nobody replies by a time you choose, list the reminders still waiting and the ones that ended, and cancel one.
FollowUps.ListAsync
List reminders
Task<IReadOnlyList<JsonObject>> ListAsync( string? status = null, string? threadId = null, int? limit = null, string? apiKey = null, CancellationToken cancellationToken = default)Returns the reminders you set on mail you sent, newest first: the ones still waiting for a reply and the ones that ended. A reminder is waiting until somebody replies (answered), its time comes with no reply (due, and the thread is back at the top of the inbox, unread) or it is cancelled.
An API key lists the reminders of the workspace owner, and an app those of the person who connected it. A key or an app limited to particular addresses lists only reminders on threads delivered to them. They come back as one plain list with no paging, and limit caps how many.
Paramètres
statusstring?Only reminders in this state:
waiting,answered,dueorcancelled.threadIdstring?Only the reminders on this thread.
limitint?How many to return, newest first, from 1 to 200. 100 when left out.
cancellationTokenCancellationTokenCancels the request.
apiKeystring?Overrides the client's API key for this call only.
Retourne
A list of JsonObject items, each { object: 'follow_up', id, threadId, messageId, emailId, subject, remindAt, status, answeredAt, firedAt, createdAt }. threadId is null until a scheduled message with a reminder goes out, emailId names the email when the reminder was set with followUpAt, answeredAt is null unless answered and firedAt is null unless due.
Exemple
using OpenEmail.Constants; var waiting = await client.FollowUps.ListAsync(status: FollowUpStatuses.Waiting, limit: 50); foreach (var reminder in waiting){ Console.WriteLine($"{reminder["subject"]} comes back at {reminder["remindAt"]}");}Remarques
In
query,is:waitingfinds the same conversations throughThreads.ListAsync: the ones with a reminder nobody has answered yet.Read only, so the SDK retries it after a network failure like any other read.
Aussi disponible dans
- API
GET /follow-ups- TypeScript
followUps.list()- Python
follow_ups.list()- Ruby
follow_ups.list- PHP
followUps->list- Go
FollowUps.List- Java
followUps().list- CLI
openemail follow-ups list
FollowUps.SetAsync
Set a reminder on a thread
Task<JsonObject> SetAsync( IReadOnlyDictionary<string, object?> body, string? apiKey = null, CancellationToken cancellationToken = default)Asks to be reminded about a thread if nobody replies by remindAt. If a real reply arrives first, the reminder closes by itself. Otherwise, when the time comes, the thread returns to the top of the inbox, unread, with the built-in FOLLOW_UP label and a push to your phones. Automatic replies, delivery reports and your own sending address do not count as a reply.
A thread holds one waiting reminder per person, so setting another moves the time. remindAt takes a DateTimeOffset or an ISO 8601 string with an offset. To set one as you send, pass followUpAt to Emails.SendAsync instead.
Paramètres
threadIdstringObligatoireThe thread to be reminded about, as
Threads.ListAsyncreturns it.remindAtDateTimeOffset or stringObligatoireWhen the thread comes back if nobody replied: a future instant, at most 365 days out.
cancellationTokenCancellationTokenCancels the request.
apiKeystring?Overrides the client's API key for this call only.
Retourne
A JsonObject, the reminder with status set to waiting: { object: 'follow_up', id, threadId, messageId, emailId, subject, remindAt, status, answeredAt, firedAt, createdAt }.
Exemple
var reminder = await client.FollowUps.SetAsync(new Body{ ["threadId"] = "CAHk7pQ2x9LmZ4-mail.example.com", ["remindAt"] = DateTimeOffset.UtcNow.AddDays(3),}); Console.WriteLine($"{reminder["id"]} is {reminder["status"]} until {reminder["remindAt"]}");Remarques
A
remindAtthat is not in the future, or is more than 365 days out, is a 422invalid_follow_up. A thread that does not exist, or one delivered to no address the key covers, is a 404.An API key sets the reminder for the workspace owner, and an app for the person who connected it. The push goes out unless that person turned
phoneFollowUpsoff insettings.The SDK retries this call after a network failure, which is safe because setting the same time twice leaves one reminder.
Aussi disponible dans
- API
POST /follow-ups- TypeScript
followUps.set()- Python
follow_ups.set()- Ruby
follow_ups.set- PHP
followUps->set- Go
FollowUps.Set- Java
followUps().set- CLI
openemail follow-ups set
FollowUps.CancelAsync
Cancel a reminder
Task<JsonObject> CancelAsync( string id, string? apiKey = null, CancellationToken cancellationToken = default)Cancels a waiting reminder, so the thread stays where it is when the time comes. A reminder that already ended is returned as it is, which is why the SDK retries this call. Only your own reminders can be cancelled.
Paramètres
idstringObligatoireThe id of the reminder,
fup_and 24 hex characters, asListAsyncreturns it.cancellationTokenCancellationTokenCancels the request.
apiKeystring?Overrides the client's API key for this call only.
Retourne
A JsonObject, the reminder as it is now: cancelled when it was waiting, and unchanged when it had already ended.
Exemple
var reminder = await client.FollowUps.CancelAsync("fup_3f9a1c07d2b84e6a9c5b1f20"); Console.WriteLine($"{reminder["id"]} is {reminder["status"]}");Remarques
An unknown id, and a reminder somebody else set, are each a 404. So is one on a thread delivered to no address the key covers.
A cancelled reminder is kept, and
ListAsyncreturns it withstatusset tocancelled.