openemail.follow_ups
この名前空間のすべてのメソッドの、シグネチャ、パラメーター、戻り値、例。
メソッド
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.
follow_ups.list()
List reminders
def list( *, status: FollowUpStatus | None = None, thread_id: str | None = None, limit: int | None = None, api_key: str | None = None, timeout: float | None = None,) -> builtins.list[FollowUpResource]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.
パラメーター
statusFollowUpStatusOnly reminders in this state:
waiting,answered,dueorcancelled, one ofFOLLOW_UP_STATUSES.thread_idstrOnly the reminders on this thread.
limitintHow many to return, newest first, from 1 to 200. 100 when left out.
api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
戻り値
list[FollowUpResource], each with object set to follow_up, id, threadId, messageId, emailId, subject, remindAt, status, answeredAt, firedAt and createdAt. threadId is None until a scheduled message with a reminder goes out, emailId names the email when the reminder was set with followUpAt, answeredAt is None unless answered and firedAt is None unless due.
例
from openemail import openemail waiting = openemail.follow_ups.list(status='waiting') for reminder in waiting: print(reminder['subject'], reminder['remindAt'])注意事項
In
query,is:waitingfinds the same conversations throughthreads.list: the ones with a reminder nobody has answered yet.Read only, so the SDK retries it after a network failure like any other read.
ほかの提供先
follow_ups.set()
Set a reminder on a thread
def set( body: FollowUpSet, *, api_key: str | None = None, timeout: float | None = None,) -> FollowUpResourceAsks 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 datetime or an ISO 8601 string with an offset, and the SDK sends a datetime as a UTC ISO 8601 string. To set one as you send, pass followUpAt to emails.send instead.
パラメーター
body['threadId']str必須The thread to be reminded about, as
threads.listreturns it.body['remindAt']datetime | str必須When the thread comes back if nobody replied: a future instant, at most 365 days out.
api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
戻り値
FollowUpResource, the reminder with status set to waiting, in the shape list returns: object set to follow_up, id, threadId, messageId, emailId, subject, remindAt, status, answeredAt, firedAt and createdAt.
例
from datetime import datetime, timedelta, timezone from openemail import openemail remind_at = datetime.now(timezone.utc) + timedelta(days=3) reminder = openemail.follow_ups.set({'threadId': 'thr_8f2c41d0a3b94e6f', 'remindAt': remind_at}) print(reminder['id'], reminder['status'], reminder['remindAt'])注意事項
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.
A naive
datetimeis read in the local zone of the machine running the SDK, so give it atzinfo.
ほかの提供先
follow_ups.cancel()
Cancel a reminder
def cancel( id: str, *, api_key: str | None = None, timeout: float | None = None,) -> FollowUpResourceCancels 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.
パラメーター
idstr必須The id of the reminder,
fup_and 24 hex characters, aslistreturns it.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
戻り値
FollowUpResource, the reminder as it is now: cancelled when it was waiting, and unchanged when it had already ended.
例
from openemail import openemail cancelled = openemail.follow_ups.cancel('fup_4c1b257a9e3d6f8025b7c1d4') print(cancelled['status'], cancelled['remindAt'])注意事項
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
listreturns it withstatusset tocancelled.