-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (42 loc) · 2.02 KB
/
Copy pathp24_curlToTriggerApi.yaml
File metadata and controls
48 lines (42 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Email Notification using API
on:
workflow_dispatch:
jobs:
email-notify-job:
runs-on: ubuntu-latest
steps:
- name: Install jq (for JSON parsing)
run: sudo apt-get install -y jq
- name: Get Notification Token
id: get_token
run: |
response=$(curl -s --location '${{ secrets.NOTIF_TOKEN_URL }}' \
--header 'x-api-key: ${{ secrets.NOTIF_API_KEY }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"clientId": "${{ secrets.NOTIF_CLIENT_ID }}",
"clientSecret": "${{ secrets.NOTIF_CLIENT_SECRET }}"
}')
echo "Token fetched."
token=$(echo "$response" | jq -r '.token')
echo "token=$token" >> $GITHUB_OUTPUT
- name: Send Email via Notification API
run: |
curl --location '${{ secrets.NOTIF_EMAIL_URL }}' \
--header 'x-api-key: ${{ secrets.EMAIL_API_KEY }}' \
--header "x-notification-service-integration-token: ${{ steps.get_token.outputs.token }}" \
--form 'templateName=Document_Management_Service_Email_Template' \
--form 'organizationId=123477' \
--form 'applicationId=runner' \
--form 'recipientEmails=ashish.mishra@dpworld.com' \
--form 'ccEmails=' \
--form 'bccEmails=' \
--form 'metadata={
\"data\":{
\"htmlBody\":\"<div style=\\\"font-family: Arial;\\\"><h2 style=\\\"color: #2c3e50;\\\">🚀 Deployment Completed</h2><p><strong>Status:</strong> Success</p><p><strong>Repo:</strong> '${{ github.repository }}'</p><p><strong>Run:</strong> <a href=\\\"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\\\">View on GitHub</a></p></div>\",
\"shipment\":\"SHP100\",
\"SHIPMENT_ID\":\"MYID100\"
},
\"from\":null,
\"subject\":\"Documents Shared from Cargoes Runner by ashish for {{shipment}}\"
}'