You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
This task involves verifying a user on the v2 bot before sending a notification and then logging the process and results in the database. The steps include checking the user's existence, adding the user if they are not already recognized, handling cases where a contact_key is not immediately available, sending the notification, and storing the notification details with its status in the database.
Acceptance Criteria:
Verify User on the v2 Bot:
Call the /contact/{pubkey} endpoint to check if the user exists.
If contact_key is empty, the bot does not recognize the user.
Add the user to the bot's known contacts by calling the /add_contact endpoint.
Expected Request Body
{
contact_info: string;
alias?: string;}
Re-check the /contact/{pubkey} endpoint to verify the contact_key is now populated.
Handling Missing contact_key:
If contact_key is still empty, store the notification details in the database with a status of WAITING_KEY_EXCHANGE.
Send Notification:
Use the /send endpoint to send the notification.
Request Body for Text Messages:
{
dest: string;// User's pubkey
amt_msat: 0;// Set to 0 for text messages
content: string;// Notification content
is_tribe: false;// Set to false for direct messages
wait: true;// Set to true for synchronous behavior}
Expected Response:
{
status: SendOnionStatus;// "COMPLETE", "PENDING", or "FAILED"
tag: string;
preimage?: string;
payment_hash?: string;
message?: string;// Error message if status == "FAILED"}
Log the notification details and the response in the database, including the status (COMPLETE, PENDING, or FAILED).
Database Integration:
Ensure the database table notifications is used for tracking. Fields should include:
Description:
This task involves verifying a user on the v2 bot before sending a notification and then logging the process and results in the database. The steps include checking the user's existence, adding the user if they are not already recognized, handling cases where a
contact_key
is not immediately available, sending the notification, and storing the notification details with its status in the database.Acceptance Criteria:
Verify User on the v2 Bot:
Call the
/contact/{pubkey}
endpoint to check if the user exists.contact_key
is empty, the bot does not recognize the user.Add the user to the bot's known contacts by calling the
/add_contact
endpoint.Re-check the
/contact/{pubkey}
endpoint to verify thecontact_key
is now populated.Handling Missing
contact_key
:contact_key
is still empty, store the notification details in the database with a status ofWAITING_KEY_EXCHANGE
.Send Notification:
Use the
/send
endpoint to send the notification.Request Body for Text Messages:
Expected Response:
Log the notification details and the response in the database, including the status (
COMPLETE
,PENDING
, orFAILED
).Database Integration:
notifications
is used for tracking. Fields should include:event
(e.g.,bounty_assigned
)pubkey
content
retries
status
uuid
created_at
This ticket depends on this ticket
The text was updated successfully, but these errors were encountered: