Notes¶
Creating and managing notes/todos.
For todos tied to a calendar, refer to the Calendaring module.
The structure of a note:
%{
id: string
title: nil | string,
note: nil | string,
tags: string[],
status: "new" | "done",
location: nil | string,
start_at: nil | string,
due_at: nil | string,
assigned_to: nil | %{id: string, name: string},
metadata: nil | map(),
conversation_id: string,
user_id: string
}
Notes.create(params)¶
Create a new note.
Options:
:title: String with the title of the todo.:note: The main body describing the work that needs to be done.:status: Either:newor:done. Defaults to:new.:tags: A list of tags to assign to the todo.:location: Same as the location field inCalendaring.add_todo.:start_at: When the todo should start.:due_at: Deadline for when the todo needs to be a done.:metadata: A map containing arbitrary metadata for the note. This information is also present in the note webhook.
Notes.delete(id)¶
Deletes a note if it exists.
Examples:
_note = Notes.create(...)
# Both are fine:
Notes.delete(_note)
Notes.delete(_note.id)
Notes.get(id)¶
Lookup a note either by ID or using an existing note.
Examples:
_note = Notes.create(...)
_note = Notes.get(_note.id)
if _note do
# do something with the note.
end
# You can also pass the full note to refetch it.
_note = Notes.get(_note)
Notes.list(opts \\ [])¶
Searches for notes.
By default this will only list notes for the current conversation,
but you can expand the scope with the :scope option.
Options:
-
:scope: The scope within which to search for notes. Can be one of::conversationthe current conversation (default).:userto search for notes from all conversation with the current user.:botto search any notes within the bot.
-
:search_query: A string to search for. This will search thetitleandnotefields. -
:limit: The number of results to return. Defaults to at most 20. Must be a number between 1 and 100. -
:status: Limit results to notes with this status. Can be either:newor:done.
Notes.save(map)¶
Create or update a note.
Examples:
_note = Notes.save(note: "Call me back")
_note.title = "A descriptive title"
_note = Notes.save(_note)
Notes.delete(_note)
# Save fails after delete.
Notes.save(_note) == nil
Notes.update(note, attrs)¶
Update a note.
Options:
:title: String with the title of the todo.:note: The main body describing the work that needs to be done.:status: Either:newor:done. Defaults to:new.:tags: A list of tags to assign to the todo.:location: Same as the location field inCalendaring.add_todo.:start_at: When the todo should start.:due_at: Deadline for when the todo needs to be a done.:metadata: A map containing arbitrary metadata for the note. This information is also present in the note webhook.