Lodol Docs

Gmail

API actions for the Gmail integration.

Gmail

Send, read, and manage email from your Gmail account.


Add label to message

Add a label to a Gmail message.

Parameters

ParameterTypeRequiredDescription
message_idstringYesGmail message ID
label_namestringYesName of the label to add
create_if_missingbooleanNoCreate the label if it does not exist

Response

{
  "label_id": "Label_123",
  "message_id": "18abc123def456",
  "thread_id": "18abc123def456"
}

Archive email

Archive a Gmail message so it no longer appears in the inbox.

Parameters

ParameterTypeRequiredDescription
message_idstringYesGmail message ID

Response

{
  "status": "success"
}

Create draft

Create an email draft in Gmail.

Parameters

ParameterTypeRequiredDescription
tostringYesRecipient email address(es). Separate multiple recipients (including variables) with commas.
subjectstringYesEmail subject line
bodystringYesPlain text body of the email
ccstringNoOptional Cc recipients. Separate multiple addresses (including variables) with commas.
bccstringNoOptional Bcc recipients. Separate multiple addresses (including variables) with commas.

Response

{
  "id": "r123456789",
  "message_id": "18abc123def456"
}

Create label

Create a new Gmail label.

Parameters

ParameterTypeRequiredDescription
labelstringYesName of the label to create

Response

{
  "label": "My Label",
  "label_id": "Label_123",
  "label_list_visibility": "labelShow",
  "message_list_visibility": "show"
}

Create reply message

Create a reply message in a thread.

Parameters

ParameterTypeRequiredDescription
message_idstringYesThe ID of the email to reply to
subjectstringNoEmail subject line. Leave blank to reuse the original email's subject with a 'Re:' prefix.
bodystringYesPlain text body of the reply
attachmentsarrayNoFiles to attach to the reply. Upload a file or reference a document (or list of documents) from an earlier step.
ccstringNoOptional Cc recipients. Separate multiple addresses (including variables) with commas.
bccstringNoOptional Bcc recipients. Separate multiple addresses (including variables) with commas.

Response

{
  "status": "success"
}

Delete email

Move a Gmail message to the trash.

Parameters

ParameterTypeRequiredDescription
message_idstringYesGmail message ID

Response

{
  "status": "success"
}

Download attachments

Download all attachments from a Gmail message.

Parameters

ParameterTypeRequiredDescription
senderstringYesOnly download attachments from emails sent by this address

Response

{
  "documents": [
    {
      "content_type": "application/pdf",
      "filename": "attachment1.pdf",
      "size_bytes": 2048
    }
  ],
  "filepaths": [
    "/tmp/attachment1.pdf",
    "/tmp/attachment2.docx"
  ]
}

Find email

Find the first Gmail email that matches your search.

Parameters

ParameterTypeRequiredDescription
querystringYesWhat to search for, using Gmail's search format
unread_onlybooleanNoIf true, only search unread emails
in_inboxbooleanNoIf true, only search in inbox

Response

{
  "email": {
    "body": "Hey, just wanted to follow up on our conversation from last week. Let me know if you have any questions.",
    "from": "sender@example.com",
    "id": "18abc123def456",
    "reply_body": "Hey, just wanted to follow up on our conversation from last week. Let me know if you have any questions.",
    "sender": "sender@example.com",
    "snippet": "Hey, just wanted to follow up on...",
    "subject": "Hello",
    "thread_id": "18abc123def456"
  }
}

Get message headers

Get the header details of a Gmail message, such as From, To, Subject, and Date.

Parameters

ParameterTypeRequiredDescription
message_idstringYesGmail message ID

Response

{
  "Date": "Mon, 1 Jan 2024 12:00:00 +0000",
  "From": "sender@example.com",
  "Subject": "Hello World",
  "To": "recipient@example.com",
  "threadId": "18abc123def456"
}

Get most recent email

Get the most recently received email from your Gmail inbox.

Response

{
  "date": "Mon, 1 Jan 2024 12:00:00 +0000",
  "from_": "sender@example.com",
  "id": "18abc123def456",
  "snippet": "This is a preview of the email content...",
  "subject": "Hello World",
  "thread_id": "18abc123def456"
}

List emails

List emails matching filters and return message details.

Parameters

ParameterTypeRequiredDescription
limitnumberNoMaximum number of emails to return
qstringNoWhat to search for, using Gmail's search format (for example, from:foo@example.com)
unread_onlybooleanNoIf true, only return unread emails
in_inboxbooleanNoIf true, only return emails in the inbox

Response

{
  "emails": [
    {
      "body": "Hello there, this is the full email body content.",
      "from": "sender@example.com",
      "id": "18abc123def456",
      "reply_body": "Hello there, this is the full email body content.",
      "sender": "sender@example.com",
      "snippet": "Hello there",
      "subject": "Hello",
      "thread_id": "18abc123def456"
    }
  ]
}

Mark as read

Mark a Gmail message as read.

Parameters

ParameterTypeRequiredDescription
message_idstringYesGmail message ID

Response

{
  "status": "success"
}

Remove label from message

Remove a label from a Gmail message.

Parameters

ParameterTypeRequiredDescription
message_idstringYesGmail message ID
label_namestringYesName of the label to remove

Response

{
  "label_id": "Label_123",
  "message_id": "18abc123def456",
  "thread_id": "18abc123def456"
}

Send message

Send an email message or reply to a thread.

Parameters

ParameterTypeRequiredDescription
tostringYesRecipient email address(es). Separate multiple recipients (including variables) with commas.
subjectstringYesEmail subject line
bodystringYesPlain text body of the email
attachmentsarrayNoFiles to attach to the email. Upload a file or reference a document (or list of documents) from an earlier step.
ccstringNoOptional Cc recipients. Separate multiple addresses (including variables) with commas.
bccstringNoOptional Bcc recipients. Separate multiple addresses (including variables) with commas.

Response

{
  "status": "success"
}

On this page