Closed smashah closed 1 year ago
CSAT messages are blocked by:
Actually:
Listen to "event": "conversation_updated"
for "status": "resolved"
(resolvedEventData
)
const cstMsg = resolvedEventData.messages.find(x=>x.content_type === 'input_csat')
cstMsg.content
is missing link, usually 1-5 stars:
Use GET https://app.chatwoot.com/api/v1/accounts/ACCOUNT_ID/conversations/CONVO_ID/messages
const actualCstMsg = messages.payload.find(x=>x.id==cstMsg.id)
send text with link: actualCstMsg?.content
Note:
You could actually send a listMessage instead with 1-5 (license dependant). The response to that will be used send a PUT request to submit CSAT report:
CSAT content looks something like this:
Please rate this conversation, https://app.chatwoot.com/survey/responses/d2d734a5-d1dc-4048-910b-7a8462d938a9
Use regex to extract link:
Extract the csatlink:
const csatLink = "Please rate this conversation, https://app.chatwoot.com/survey/responses/d2d734a5-d1dc-4048-910b-7a8462d938a9".match(/(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])/gi)[0]
Send the csat listMsg OR link message based on license
@github-actions run
would you please to advice me how to send CSAT rate notification (like CSAT email notification) to openwa-inbox?
- https://www.chatwoot.com/docs/user-guide/features/csat