ServicesFusion

API Reference

Complete API documentation for Fusion endpoints

👤 Sai Tharun

Fusion API Reference

Fusion exposes HTTP endpoints for enqueueing and managing background tasks. All endpoints accept JSON payloads.


Queue Tasks

POST /queue/

Immediately enqueue one or more tasks for processing.

Request Body:

[
  {
    "task": 1,
    "task_type": 1,
    "data": {
      "contact": 9876543210,
      "message": "Hello World",
      "countryCode": 91,
      "senderId": "CRELIO"
    },
    "log_tag": "SMS_OTP",
    "headers": {},
    "subscribe": "https://callback.url/notify",
    "failed_task_handler": "https://callback.url/failed",
    "success_task_handler": "https://callback.url/success",
    "override_priority": 2
  }
]

Parameters:

FieldTypeRequiredDescription
taskintYesTask type (1=SMS, 2=Email, 3=PN, 4=Webhook, 6=WhatsApp)
task_typeintYesSub-type of the task
dataobjectYesTask-specific payload
log_tagstringNoCustom tag for logging
headersobjectNoHTTP headers for webhooks
subscribestringNoURL for result callbacks
failed_task_handlerstringNoURL to call when task fails
success_task_handlerstringNoURL to call when task succeeds
override_priorityintNoOverride default priority (0, 1, or 2)
retryintNoNumber of retry attempts (max 10)

Response:

{
  "code": 200,
  "job_ids": ["job-uuid-1", "job-uuid-2"]
}

Task Types Reference

Task 1: SMS

task_typeNamePriorityFunction
1OTPHIGH (2)tasks.sms.sendOTPSMS
2App LinksLOW (0)tasks.sms.sendSMS
3WelcomeMODERATE (1)tasks.sms.sendSMS
4Billing ReportMODERATE (1)tasks.sms.sendSMS
5Appointment/HCMODERATE (1)tasks.sms.sendSMS
6CampaignLOW (0)tasks.sms.sendSMS
7ReminderHIGH (2)tasks.sms.sendSMS

SMS Payload:

{
  "contact": 9876543210,
  "message": "Your OTP is 1234",
  "countryCode": 91,
  "senderId": "CRELIO",
  "otp": 1234,
  "config": {
    "provider": "msg91"
  },
  "callback_url": "https://..."
}

Task 2: Email

task_typeNamePriorityFunction
1WelcomeMODERATE (1)tasks._email_v2.send_plain_email
2Billing ReportMODERATE (1)tasks._email_v2.send_plain_email
3AdminMODERATE (1)tasks._email_v2.send_plain_email
4MiscLOW (0)tasks._email_v2.send_plain_email
5TemplateLOW (0)tasks._email_v2.send_template_attachment_email
6AttachmentLOW (0)tasks._email_v2.send_template_attachment_email

Email Payload:

{
  "to": ["user@example.com"],
  "cc": [],
  "bcc": [],
  "subject": "Email Subject",
  "message": "<html>Email body</html>",
  "sender_name": "CrelioHealth",
  "sender_email": "no-reply@creliohealth.com",
  "files": ["https://s3.amazonaws.com/.../file.pdf"],
  "template": "<html>Template HTML</html>",
  "is_template": 1,
  "callback_url": "https://..."
}

Task 3: Push Notification

task_typeNamePriority
1ReportsMODERATE (1)
2Appointment/HCMODERATE (1)
3PromotionsMODERATE (1)
4CampaignLOW (0)
5FeedbackLOW (0)
6RemindersHIGH (2)

Task 4: Webhook

task_typeNamePriorityFunction
1GETMODERATE (1)tasks.webhooks.GET
2POSTMODERATE (1)tasks.webhooks.POST
3PUTMODERATE (1)tasks.webhooks.PUT
4DELETEMODERATE (1)tasks.webhooks.DELETE

Webhook Payload:

{
  "url": "https://api.example.com/endpoint",
  "args": {"key": "value"},
  "isBody": 1,
  "timeout": 15,
  "callback": 1,
  "callback_url": "https://callback.url",
  "headers": {
    "Authorization": "Bearer token"
  }
}

Task 6: WhatsApp

task_typeNamePriorityFunction
1WelcomeMODERATE (1)tasks.whatsapp.sendWhatsapp
2Billing ReportMODERATE (1)tasks.whatsapp.sendWhatsapp_withFile

Schedule Tasks

POST /schedule/

Schedule tasks for future execution.

Request Body:

[
  {
    "sch_time": "2024-01-15T10:30:00",
    "task": 1,
    "task_type": 2,
    "data": {...},
    "subscribe": "https://...",
    "headers": {}
  }
]

Parameters:

FieldTypeRequiredDescription
sch_timestringYesScheduled time in YYYY-MM-DDTHH:MM:SS format (UTC)
taskintYesTask type
task_typeintYesSub-type of the task
dataobjectYesTask-specific payload
window_delaystringNoKey for window-based consolidation
override_windowintNo1 to override existing window

Response:

{
  "code": 200,
  "job_ids": ["job-uuid-1"]
}

Job Management

POST /jobInfo/

Get information about a specific job.

Request Body:

{
  "id": "job-uuid"
}

POST /cancelJob/

Cancel one or more scheduled jobs.

Request Body:

{
  "job_id": ["job-uuid-1", "job-uuid-2"]
}

Response:

{"code": 200}   // Success
{"code": 401}   // Job not found
{"code": 500}   // Error

POST /rescheduleJob/

Reschedule a job to a new time.

Request Body:

{
  "job_id": "job-uuid",
  "resc_at": "2024-01-16T14:00:00"
}

Response:

{"code": 200}   // Success
{"code": 401}   // Job not found or already executed

POST /retryTask/

Retry a failed task with a 2-minute delay.

Request Body:

[
  {"job_id": "job-uuid"}
]

Utility Endpoints

POST /mapping/

Queue dictionary mapping tasks for processing.

Request Body:

[
  {"keyword": "term1", "data": {...}},
  {"keyword": "term2", "data": {...}}
]

POST /update_consent/

Update WhatsApp consent for a user.

Request Body:

{
  "type": "consent_type",
  "cache_key": "unique_key",
  "details_obj": {...}
}

Error Codes

CodeDescription
200Success
401Job not found
500Internal server error

On this page