How extensible are payload hooks

default discord avatar
midka
3 months ago
2

Hey everyone!


I'm currently comparing my options for building a website for an event. It has to have functionality to vote for a team. Voting would be '1 vote/phone number' so is that possible with (maybe collection) hooks? It would use an external API for sending a SMS and verify the code that would be stored in another collection.



Thanks!

  • discord user avatar
    alessiogr
    Payload Team
    3 months ago

    Hi there,



    sounds like that should be easily possible! You could use a field

    validate

    to check if there have been multiple votes for that phone number, and if so, reject it there.



    In an afterChange or beforeChange hook, you could then trigger the sending of an SMS, so that it would trigger whenever a new Vote has been created

  • default discord avatar
    midka
    3 months ago

    Oh, thanks! Just wanted to confirm :)

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.