Solved

Accessing Emails with Plugin

  • 9 December 2022
  • 3 replies
  • 45 views

Badge +2

I need a little direction with something I’m struggling with. One of my teammates previously wrote a webhook that triggered whenever an email was received. This works regardless of if the user opens the email.

I’m looking for a way to limit the amount of times the function executes so instead I’m trying to build functionality that will on a button click within the plugin, select some emails starting at the newest in the current email inbox and run a function on each of them.

Any chance someone can point me in the right direction?
Thanks!
 

icon

Best answer by Javier - Developer Relations 9 December 2022, 02:05

View original

3 replies

Userlevel 5
Badge +8

Hello! The plugin context only has access to the conversations selected by the Front teammate in the UI.  The plugin SDK can't modify the current selection.  However, you could use information about a selection to perform server-side updates through the Core API.

 

--Evan

Badge +2

Got it, so truly the only way to access the contents of emails other than the currently selected email is via writing a webhook which listens for incoming emails?

Userlevel 5
Badge +8

Writing a webhook that listens for incoming emails and performs sever-side updates is one way. Definitely not the only way because you can also access all of a conversation's messages through the Core API as well: 

 

https://dev.frontapp.com/reference/get_conversations-conversation-id-messages

 

For all the extra lifting to implement that, you may consider whether the Plugin SDK's multi-select feature addresses your bulk update needs.  That is, an agent selects multiple conversation in-app and then clicks a button in the plugin to perform the action.

Reply