# Msg91

MSG91 is a cloud communication platform offering secure and robust APIs for SMS, WhatsApp, Email, Voice, and more, enabling businesses to connect with their customers across multiple channels.

- **Category:** communication
- **Auth:** API_KEY
- **Composio Managed App Available?** N/A
- **Tools:** 8
- **Triggers:** 0
- **Slug:** `MSG91`
- **Version:** 20260312_00

## Tools

### Create User Events

**Slug:** `MSG91_CREATE_USER_EVENTS`

Create and track user events in MSG91 Segmento for customer behavior analysis and segmentation. Use this tool to record user actions and behaviors such as logins, purchases, page views, button clicks, or any custom events. These events help build user profiles and enable targeted campaigns based on user behavior. Examples: - Track user login events for engagement analysis - Record purchase events with product details for sales tracking - Log page views and clicks for behavior analytics - Capture custom events with properties for detailed segmentation

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `events` | array | Yes | List of user events to record. You can submit multiple events for the same user in a single request. |
| `identifier` | string | Yes | Unique identifier for the user. Can be an email address or phone number with country code (e.g., '+919999999999' or 'user@example.com'). |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Event Types

**Slug:** `MSG91_GET_EVENT_TYPES`

Retrieves all event types configured in MSG91 Segmento. Event types represent different user actions and behaviors that can be tracked (e.g., purchases, signups, page views). Use this action to discover what events are available for tracking user behavior in your Segmento account. No parameters required - returns all event types.

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Failed Events

**Slug:** `MSG91_GET_FAILED_EVENTS`

Retrieve failed user events from a MSG91 Segmento campaign. This tool fetches events that failed to process during campaign execution, helping you identify and debug issues such as validation errors, invalid recipients, or missing required data. Use this when you need to: - Investigate why certain events didn't process successfully - Get detailed failure reasons for troubleshooting - Monitor campaign health and identify patterns in failures - Retrieve failed events within a specific date range Results are paginated for large datasets. Requires a valid campaign_id from a Segmento campaign.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `page` | integer | No | Page number for pagination. Starts at 1. Use this to navigate through multiple pages of failed events. |
| `limit` | integer | No | Maximum number of failed events to return per page. Must be between 1 and 100. Default is 10. |
| `end_date` | string | No | Optional end date to filter failed events (format: YYYY-MM-DD). Only events that failed on or before this date will be included. |
| `start_date` | string | No | Optional start date to filter failed events (format: YYYY-MM-DD). Only events that failed on or after this date will be included. |
| `campaign_id` | string | Yes | The unique identifier of the Segmento campaign. This is the campaign ID returned when creating or listing campaigns. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Campaigns

**Slug:** `MSG91_LIST_CAMPAIGNS`

Tool to list all campaigns in Segmento. Use when you need to retrieve campaigns with pagination support.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `page` | integer | No | Page number for pagination. |
| `limit` | integer | No | Number of campaigns per page. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Resend OTP

**Slug:** `MSG91_RESEND_OTP`

Resend OTP to the same mobile number via text message or voice call. Use when the original OTP was not received or expired, and the user needs a new code sent to the same number.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `mobile` | string | Yes | Mobile number to resend OTP to, in international format without '+' prefix (e.g., '919999999999' for India). Must be the same number that received the original OTP. |
| `retrytype` | string ("text" | "voice") | Yes | Method to resend the OTP: 'text' for SMS message or 'voice' for voice call. Voice calls are useful when SMS delivery fails or for accessibility. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Send OTP

**Slug:** `MSG91_SEND_OTP`

Tool to send OTP (One-Time Password) to a mobile number using a pre-configured MSG91 template. Use when you need to verify user phone numbers for authentication, account registration, password reset, or transaction confirmation.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `otp` | string | No | Custom OTP value to send. If not provided, MSG91 will auto-generate an OTP based on otp_length parameter. Use this when you need to send a specific OTP code. |
| `mobile` | string | Yes | Recipient mobile number in international format with country code (e.g., '919999999999' for India, '15551234567' for USA). Do not include '+' prefix or spaces. |
| `userip` | string | No | End user's IP address for security tracking and fraud prevention. Helps identify the request origin. |
| `unicode` | integer | No | Set to 1 for sending SMS in non-English languages (Hindi, Arabic, Chinese, etc.). Set to 0 for English only. Default: 0 |
| `invisible` | integer | No | For MOBILE APP only (do not use for web browsers). Set to 1 to enable invisible OTP verification, 0 to disable. Default: 0 |
| `otp_expiry` | integer | Yes | OTP expiry time in minutes. Minimum: 1 minute, Maximum: 10080 minutes (7 days), Default: 60 minutes. After this duration, the OTP becomes invalid. |
| `otp_length` | integer | No | Number of digits in the auto-generated OTP. Minimum: 4, Maximum: 9, Default: 4. Only applies when 'otp' parameter is not provided. |
| `template_id` | string | Yes | OTP template ID from the OTP section of MSG91 dashboard. This template defines the SMS content format with OTP placeholder. |
| `realTimeResponse` | integer | Yes | Set to 1 to enable real-time response due to caching. This provides immediate delivery status. Set to 0 for standard response. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Send SMS via Flow (V5)

**Slug:** `MSG91_SEND_SMS_V5`

Send SMS messages using pre-defined templates via MSG91 Flow API v5. Use when you need to send template-based SMS with dynamic variable substitution to single or multiple recipients. Templates must be created and approved in MSG91 dashboard before use.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `short_url` | string | No | Enable URL shortening in SMS: '1' to enable, '0' to disable. When enabled, long URLs in the message are automatically shortened to save characters. Default: '0' |
| `recipients` | array | Yes | Array of recipient objects containing mobile numbers and dynamic variable values. Each recipient can have different variable values for personalized messages. |
| `template_id` | string | Yes | SMS template ID (Flow ID) from MSG91 dashboard. Create templates at https://control.msg91.com/flow/. Template must be approved before use. |
| `realTimeResponse` | string | No | Enable real-time delivery response: '1' to get immediate delivery status for each message. Note: This may increase response time. Default: '0' (asynchronous) |
| `short_url_expiry` | integer | No | Short URL expiry time in seconds. Only applicable when short_url is enabled. After expiry, the shortened URL will no longer redirect. Default: no expiry |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Verify OTP

**Slug:** `MSG91_VERIFY_OTP`

Tool to verify an OTP (One-Time Password) sent to a mobile number. Use when you need to confirm that the OTP code entered by the user matches the one sent via Send OTP API.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `otp` | string | Yes | The OTP code to verify. This is the code that was sent to the mobile number via Send OTP API and entered by the user. |
| `mobile` | string | Yes | Mobile number in international format with country code (e.g., '919876543210' for India, '15551234567' for USA). Must match the number used in Send OTP. Do not include '+' prefix or spaces. |
| `otp_expiry` | integer | No | OTP expiry time in minutes. Only required if you passed a custom expiry time when sending the OTP. If not provided, the default expiry time (60 minutes) is used. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |
