Requirements for the API Request
- Your API Token: "Bearer" + Space( ) + The token you generated in Step 3. For example: Bearer apit_KjLAhuzJIdAA9SpZfLEUOAMs8D1450k16ppuRW - The bot ID: The ID of the message flow…
-
Your API Token: "Bearer" + Space( ) + The token you generated in Step 3. For example: Bearer apit_KjLAhuzJIdAA9SpZfLEUOAMs8D1450k16ppuRW
-
The bot ID: The ID of the message flow you created in Step 1. This can be found at the end of the URL of your message flow. For example, if your URL is https://www.app.chatdaddy.tech/automation/messageFlows/addEdit/**bot_8d3b30d69965baf7 , your bot ID would be bot_8d3b30d69965baf7**.
-
Receiver's Phone Number: The phone number of the recipient with the country code.
-
Your Account ID(optional): In case you have multiple channels, you can select which channel you want to send the message from by going to "Manage Channels" and copying the ID of your channel
-
Pre-generated OTP: The OTP you want to send to your client.
❗ Note: The OTP will have to be generated by your own system and will not be done by ChatDaddy
Example Code
Here's an example of how to send an OTP using the ChatDaddy API. You will need to replace the variables in bold with actual values
YOUR_BOT_ID** : **bot_8d3b30d69965baf7
YOUR_API_TOKEN : Bearer apit_KjLAhuzJIdAA9SpZfLEUOAMs8D1450k16ppuRW
YOUR_ACCOUNT_ID : acc_36dce712-a9eb-4275-96_ca8s
CONTACT_WITH_COUNTRY_CODE : 918074906794
YOUR_OTP : 123456
`const url = 'https://api-bots.chatdaddy.tech/bots/``YOUR_BOT_ID``/fire'; const options = { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json', Authorization: 'Bearer
YOUR_API_TOKEN' }, body: JSON.stringify({ accountId: 'YOUR_ACCOUNT_ID', toContact: 'CONTACT_WITH_COUNTRY_CODE' parameters: { verificationCode: 'YOUR_OTP' } }) };
try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); }`
Conclusion
By following these steps, you can set up a system to send OTPs to your clients through ChatDaddy. If you have any further questions or need assistance, feel free to contact our support team.