Anyone familiar with creating server-side plugins? I need someone to help me with some initial questions over a screenshare – can pay in kindness, cold hard cash, or crypto. Please private message me if you’re interested.
Yep, I’m familiar with that (I’ve not been messing with it much lately as that’s been on back burner while I finish Calendar Grid plugin). I could mebbe do some screen-share time later. In the meantime, is this a “not even sure where to get started?” type question, or a “there’s something specific I’m havin’ trouble with” question?
Oh well, I don’t really have that much practice right now with server side plugins, all I did was working with some network requests to interact with external resources and running some functions then returning their values from server, very basic stuff.
If you think that “very basic” may help you, feel free to message me!
I appreciate the mention
Thanks guys, I’m trying to setup a plugin for SimpleParser (https://nodemailer.com/extras/mailparser/) and my JS skills are lacking. I’m trying to figure out how to get data in and then back out.
I’ll have one input (input) and multiple outputs (subject, from, to, etc.).
Took a look at it, seems quite straightforward to use, but how exactly are you expecting to get the email to be input as the source? Also, how do you plan to use the data once it gets parsed? So we can think about ways to do it.
Use case: I want to consume google emails through their api for use in my app.
I already have the data. It’s currently in base64url which I think mailparser can handle. Their documentation is very sparse, so, if needed, I can decode in a pre-workflow step before sending to the mailparser action.
gmail creates rfc822 emails and base64url encodes them. I’m getting the raw body and trying to pass it to mailparser for processing. Then, send the different parts of the email (subject, body, to, from, etc.) to a table in my database through the plugin’s outputs that I’ve defined for the different parts (e.g. subject, body, to, from). One output will equal one field in the table.
Thanks @antony. The problem I am unable to figure out is, how to pass the values from the various items back to the outputs I’ve defined in the plugin. Here is some simple code, which works in repl.it, but I’m not able to figure out how to pass the values (e.g. parsed.subject) into my plugin’s output(s) (e.g. subject).
var my_title_out, my_email_out, my_messaging_out;
// lots of data processing...
return {"title_out":my_title_out, "email_out":my_email_out, "messaging_out":my_messaging_out, "error_out":false};
Passing Values Back Out - Element Based Client Side
I have created a similar element based client side plugin, so it has the same outputs (or “Exposed States” in this case) defined as follows:
I encountered exactly the same issue with another node module over the weekend. I tried a number of different “async” approaches to no avail; although I did manage to trigger several server (500 status code) errors.
I wonder if @marca, the “node meister”, might be able to shed some light. Knowing how to get such values back into Bubble would certainly open up some possibilities with SSA’s.
@bubble’s documentation is severely lacking for this. I had to enlist three different node/javascript experts, and the first two said it couldn’t be done or that Bubble’s documentation needed more details and to contact them for help.
The final person was able to figure it out after much trial and error with the below code being the end result that I hope will help others. So, I’d like to give a big recommendation to Nigel Peck on the Codementors site. If you need any help with coding, he knows his stuff. https://www.codementor.io/nigelbpeck
TLDR: You have to do a “return context.async…” with a callback.
The undefined value is there because, per the docs, the callback expects both err and res arguments. The bubble_return_object represents the object defined in the Return values (output values) section of the plugin editor for server-side actions.
Is context.async blocking or non-blocking?
Edit: and why use context.async instead of just using promises or async/await? Does it forces blocking on that workflow action before proceeding to the next one?
Here’s the next issue that I could use some help with. Is there a way to define if statements in the callback? I’m defining a bunch of outputs and sometimes a few of them may not have values, so I need/want to wrap them in if statements, but Bubble is complaining that it’s not correct syntax.