#Passing {threadId} to a Webhook

24 messages · Page 1 of 1 (latest)

shell kite
#

Within a flow, I am creating a new thread, and creating an adaptive threadId variable.

Would it be possible to add the ability to use the passed {threadId} variable in a webhook Thread ID input field?

Essentially, give the user an option to either enter the numeric id, or {threadId}. This way we can send a webhook to the newly created thread.

quartz birch
#

i'm not sure what you mean by this exactly. are you referring to an expansion upon the existing functionality for this?

hardy lava
#

I know what they mean because I ran into the problem yesterday, you can get the variable after creating a thread but you cant then post in the new thread from a backup as the thread ID box only accepts numeric input and wont accept the variable. So the variable is only useful as a way to link the new thread in a message.

shell kite
#

Currently, Thread ID only accepts numerical characters. Could there be an option to enter a variable here?

quartz birch
#

don't put anything in the thread ID box in the backup

#

i thought the variable would override what you set there, but i guess it doesn't

shell kite
#

I thought it might just send the message into the thread by default after creating it in the flow, but it sends the message to the channel the parent is in.

#

Unless I'm going something wrong, cause that is always possible. 😂

quartz birch
#

yeah by default it just uses the webhook's default channel

#

if you have a threadId variable it will try to send to that

#

of course, won't work if the webhook isn't in the same channel that the thread is in

shell kite
#

So, this could be the issue, and I could try with it being in the same channel. Would there be a way to fix that though?

quartz birch
#

no, that's a discord restriction

shell kite
#

Seems like you should be able to construct a full thread link though.
Something like this to reference where the message goes.

const threadLink = `discord.com{thread.guildId}/${thread.id}';

quartz birch
#

yes you should have enough info to construct those in your message

#

guildId, messageId, and i believe channelId are prefilled in the background (until they are overwritten). so you could just combine the guild id and thread id (or reference the thread id normally with <#{threadId}>

shell kite
#

I was actually referring to your code. You should be able to make an option within a backup, if the {threadId} is passed, it should be able to send it to ANY thread within the server.

quartz birch
#

In order to achieve that I would have to silently move the webhook which I think would cause unwanted consequences. Is there a reason you can’t simply specify a webhook that’s already in the channel you created the thread in?

shell kite
#

Mainly cause I'm creating a thread from outside the destination channel, and want to immediately send a message to that thread from the same flow.

hardy lava
#

that was my problem also. I wanted to create a new webhook in a different channel that has a button, that if pressed spawns a new thread and then sends a message in the new thread that pings the user who spawned it to summon them into it

#

even when i tried putting the webhook in a thread of the same forum it would always send the message in that thread instead of the new thread

shell kite
#

Yeah, I had a similar thought. My thought was to have a button in my servers "info" channel that would be for support tickets or staff applications. When pressed, it would create a thread in that corresponding channel, and send the users information over to that new thread.

quartz birch