Chimoney / chimoney-community-projects

Repo for Community Contributors
http://api.chimoney.io/
MIT License
130 stars 172 forks source link

Build Chimoney Discord Bot #61

Open Ayo-Awe opened 2 years ago

Ayo-Awe commented 2 years ago

HR, Event organizers, community managers and anyone in a Discord server should be able to send Chimoney to other users within Discord

Build a bot that rewards Discord users with Chimoney

Bot can be mentioned in a server or issue and instructed to send $N to a @user using Chimoney. Bot initiates a Chimoney payout to the email of the Discord user that is mentioned (get Slack profile by username) and sends the initiate chimoney payout with email: email_from_discord Bot sends a DM to the Discord user that initiated the Payout with a payment link to pay for the transaction on Chimoney. This link is returned from the /initiate-chimoney endpoint. Payer sees a Table on Discord build with Discord UI components with a summary of the Payout The Payer user clicks the link and is taken to the chimoney Payment page and they can pay from their Chimoney wallet Chimoney automatically sends an Email to the user that was rewarded. Optionally, reply to the original Discord comment or send a DM to the Discord User that received the Payment with the Redeem instructions that was also sent by Chimoney via email They can then redeem their reward to any of the options at dash.chimoney.io/redeem

Ayo-Awe commented 2 years ago

@uchibeke I'd like to work on this

Ayo-Awe commented 2 years ago

@uchibeke So, I'm having challenges getting the email of a discord user, I have one of the two options now

For the Oauth2 method, I'd have to setup a server to receive the Oauth payload. This is asides the server hosting the bot

uchibeke commented 2 years ago

Yes. Currently email, Twitter or phoneNumber is required to initiate a Payout

But it might be best to keep things simple and not require any action from the user because the Bot will be used by Discord users that don't understand the details of Chimoney

Consider:

After you finish the above, ping me here to review and we can move the steps below and discuss how the Webhook works

Hope this is helpful, @Ayo-Awe ?

Ayo-Awe commented 2 years ago

@uchibeke I've setup the command. It sends a payment link to the command initiator. See pull request #67

uchibeke commented 2 years ago

Follow up

Great.

Please set up Webhook in the Developer page and subscribe to the chimoney.payment.completed event

You can use https://webhook.site/ to see if you get the event after you make the payment from your wallet

If you're getting the message from the webhook, implement your own endpoint that receives the webhook message and data

  • Verify that is coming from Chimoney
  • Use the issueID to get the transaction
  • Confirm it is paid on the Chimoney side
  • Check chimoney.meta and then get and notify chimoney.meta.discordReciever and chimoney.meta.discordSender on Discord. Sample message to to the receiver is similar to what you get in your DM on twitter with the redeem link

Hope this helps? And please let me know if you have any questions

@Ayo-Awe

https://github.com/Chimoney/chimoney-community-projects/pull/67#issuecomment-1288172563

Ayo-Awe commented 2 years ago

Thanks, I’ll set it up and get back to you

Ayo-Awe commented 2 years ago

Hey @uchibeke , the frontend is currently having issues with payment links image

uchibeke commented 2 years ago

Hey @uchibeke , the frontend is currently having issues with payment links image

At what point do you get this error?

This doesn’t seem to happen with other links. Could you initiate a Chimoney with email or twitter included and try again? Also investigating

Ayo-Awe commented 2 years ago

Hey @uchibeke , the frontend is currently having issues with payment links image

At what point do you get this error?

This doesn’t seem to happen with other links. Could you initiate a Chimoney with email or twitter included and try again? Also investigating

This happens when I click any payment link and try to login

uchibeke commented 2 years ago

Could you send the Payment link, please? @Ayo-Awe

Ayo-Awe commented 2 years ago

here it is https://dash.chimoney.io/pay?issueID=f7d68f1f-3637-47a7-8db5-d69091986b27_3_1666622958343

Ayo-Awe commented 2 years ago

The moment I try to login, I get an error

uchibeke commented 1 year ago

@Ayo-Awe could you confirm if this is still the case? So we can finish this task

Ayo-Awe commented 1 year ago

@uchibeke this is still the case, I only get two events

Ayo-Awe commented 1 year ago

@uchibeke I've found a way around it though at least for the meantime. I can just initiate the payment from the bot then login to my dashboard and complete the payment there without using the link.

uchibeke commented 1 year ago

@Ayo-Awe this won’t work for external users. You see it in your dashboard because your app initiated it.

could you list out all the webhook you events you’d like to receive, please?

Ayo-Awe commented 1 year ago

@uchibeke This is the only event I'd like to receive

Ayo-Awe commented 1 year ago

@Ayo-Awe this won’t work for external users. You see it in your dashboard because your app initiated it.

could you list out all the webhook you events you’d like to receive, please?

ok I get

uchibeke commented 1 year ago

@uchibeke This is the only event I'd like to receive

  • chimoney.payment.completed

Ok. Give me the next 3 hours to test this

so this is the event that you get after you make a payment with the link, correct? AKA after status changes from unpaid to paid?

Ayo-Awe commented 1 year ago

Exactly, no problem

uchibeke commented 1 year ago

@Ayo-Awe added chimoney.payment.completed. Please let me know if you get it after payment

Also, could you confirm if you're able to go from

Ayo-Awe commented 1 year ago

@uchibeke Great, I'm getting the webhook hook message after payment.

As for the link, the flow breaks when I try to sign.

I've setup the webhook, expect new commits soon

kkrishguptaa commented 1 year ago

Hi, is this available to me to work on? Or is it done