How do I speed up the response time to Discord slash commands?

This topic was automatically generated from Slack. You can find the original thread here.

Sameer Kumar : Hi folks, I’m using Pipedream as an API to respond to Discord’s Slash command interaction API.
Problem I’m facing is that the response time of the Pipedream workflow which is triggered by an HTTP call seems unpredictable.

I’ve tried making the API flow async by responding to the HTTP call early in the flow, but even that is slow.
Q: Any thoughts/tips that I can make use of to make this process faster?

Sameer Kumar : Any help would be highly appreciated :pray:
cc

Nghia Nguyen : I can talk more later but I built a Discord bot that works perfectly off of Pipedream: the key is, you have to respond at the source level instantly and not wait for the source-based workflow to respond.

Nghia Nguyen : Code in your security checks and response at that source configuration, not at the workflow Nodejs code.

Nghia Nguyen : (meaning you need to create a custom source)

Sameer Kumar : Thanks for responding !
So if I understand correctly, I should put a Heroku/custom API which will internally call Pipedream?

Nghia Nguyen : no

Nghia Nguyen : use Pipedream’s source

Nghia Nguyen : the issue you’re encountering here is cold start penalty costing you the time to respond to Discord

Sameer Kumar : Okay yes, cold start is certainly a problem.
I wasn’t aware about the “Source” offering by Pipedream, I was always using Workflows.
Is there a way I can migrate my Workflow to Source?

Sergio Rodriguez : here is an overview of what Sources are in PD docs: Sources and here is a Quickstart: Quickstart: Source Development Feel free to post your questions, here in the help channel or our discourse community

Sameer Kumar : Thanks , let me go through this!

Sergio Rodriguez : Welcome!