Recent searches
No recent searches
Sending SMS on Creation of Ticket
Posted Jun 05, 2024
We need to send an SMS upon ticket creation, but our API requires a two-step process:
- Call an API to generate a token.
- Use the generated token to authenticate the SMS API.
Since Zendesk Webhooks don't support a two-step API call, we are looking for the best solution or approach to address this issue.
0
2
2 comments
Valentin Vina
use a function
import requests
def send_sms(ticket_id, phone_number, message):
# Step 1: Generate token
token_response = requests.post('https://example.com/generate-token', data={})
token = token_response.json().get('token')
# Step 2: Use the token to authenticate the SMS API
headers = {'Authorization': f'Bearer {token}'}
sms_response = requests.post(
'https://example.com/send-sms',
headers=headers,
data={'ticket_id': ticket_id, 'phone_number': phone_number, 'message': message}
)
return sms_response.json()
0
Harshit Srivastava
Hi Valentin,
I think we need to host this code somewhere and target it using a Zendesk webhook. However, we want to keep this functionality inside Zendesk without using any external service or middleware. Can you help with this?
Thanks!
0