personal followup email
This commit is contained in:
		
							parent
							
								
									c3eaf0351b
								
							
						
					
					
						commit
						c58ed8bd2c
					
				|  | @ -16,7 +16,7 @@ import { | |||
|   cleanDisplayName, | ||||
|   cleanUsername, | ||||
| } from '../../common/util/clean-username' | ||||
| import { sendWelcomeEmail } from './emails' | ||||
| import { sendPersonalFollowupEmail, sendWelcomeEmail } from './emails' | ||||
| import { isWhitelisted } from '../../common/envs/constants' | ||||
| import { | ||||
|   CATEGORIES_GROUP_SLUG_POSTFIX, | ||||
|  | @ -96,6 +96,7 @@ export const createuser = newEndpoint(opts, async (req, auth) => { | |||
| 
 | ||||
|   await addUserToDefaultGroups(user) | ||||
|   await sendWelcomeEmail(user, privateUser) | ||||
|   await sendPersonalFollowupEmail(user, privateUser) | ||||
|   await track(auth.uid, 'create user', { username }, { ip: req.ip }) | ||||
| 
 | ||||
|   return { user, privateUser } | ||||
|  |  | |||
|  | @ -1,3 +1,5 @@ | |||
| import * as dayjs from 'dayjs' | ||||
| 
 | ||||
| import { DOMAIN } from '../../common/envs/constants' | ||||
| import { Answer } from '../../common/answer' | ||||
| import { Bet } from '../../common/bet' | ||||
|  | @ -14,7 +16,7 @@ import { | |||
| import { getValueFromBucket } from '../../common/calculate-dpm' | ||||
| import { formatNumericProbability } from '../../common/pseudo-numeric' | ||||
| 
 | ||||
| import { sendTemplateEmail } from './send-email' | ||||
| import { sendTemplateEmail, sendTextEmail } from './send-email' | ||||
| import { getPrivateUser, getUser } from './utils' | ||||
| import { getFunctionUrl } from '../../common/api' | ||||
| import { richTextToString } from '../../common/util/parse' | ||||
|  | @ -165,6 +167,43 @@ export const sendWelcomeEmail = async ( | |||
|   ) | ||||
| } | ||||
| 
 | ||||
| export const sendPersonalFollowupEmail = async ( | ||||
|   user: User, | ||||
|   privateUser: PrivateUser | ||||
| ) => { | ||||
|   if (!privateUser || !privateUser.email) return | ||||
| 
 | ||||
|   const { name } = user | ||||
|   const firstName = name.split(' ')[0] | ||||
| 
 | ||||
|   const emailBody = `Hi ${firstName},
 | ||||
| 
 | ||||
| Thanks for signing up! I'm one of the cofounders of Manifold Markets, and was wondering how you've found your exprience on the platform so far? | ||||
| 
 | ||||
| If you haven't already, I encourage you to try creating your own prediction market (https://manifold.markets/create) and joining our Discord chat (https://discord.com/invite/eHQBNBqXuh).
 | ||||
| 
 | ||||
| Feel free to reply to this email with any questions or concerns you have. | ||||
| 
 | ||||
| Cheers, | ||||
| 
 | ||||
| James | ||||
| Cofounder of Manifold Markets | ||||
| https://manifold.markets
 | ||||
|  ` | ||||
| 
 | ||||
|   const sendTime = dayjs().add(4, 'hours').toString() | ||||
| 
 | ||||
|   await sendTextEmail( | ||||
|     privateUser.email, | ||||
|     'How are you finding Manifold?', | ||||
|     emailBody, | ||||
|     { | ||||
|       from: 'James from Manifold <james@manifold.markets>', | ||||
|       'o:deliverytime': sendTime, | ||||
|     } | ||||
|   ) | ||||
| } | ||||
| 
 | ||||
| export const sendOneWeekBonusEmail = async ( | ||||
|   user: User, | ||||
|   privateUser: PrivateUser | ||||
|  |  | |||
|  | @ -9,10 +9,12 @@ const initMailgun = () => { | |||
| export const sendTextEmail = async ( | ||||
|   to: string, | ||||
|   subject: string, | ||||
|   text: string | ||||
|   text: string, | ||||
|   options?: Partial<mailgun.messages.SendData> | ||||
| ) => { | ||||
|   const data: mailgun.messages.SendData = { | ||||
|     from: 'Manifold Markets <info@manifold.markets>', | ||||
|     ...options, | ||||
|     from: options?.from ?? 'Manifold Markets <info@manifold.markets>', | ||||
|     to, | ||||
|     subject, | ||||
|     text, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user