
While configuring the above details, you may have noticed a property named Message Type, which can be either Promotional or Transactional. You can check which countries support it from this table. But the support for sender IDs varies by country and/or region. The sender ID is displayed as the message sender on the receiving device.
Customized sms sender name code#
After that the final code should look as follows.įinal code of the lambda function Something about the Sender ID…Īs per the AWS documentation, above sender ID can be a custom ID that contains up to 11 alphanumeric characters, including at least one letter and no spaces. We can implement the callback functions of the generated code by moving the lambda callback inside them and also adding some console logs. Once you are done, click on the Inject button to generate the code snippet for this configuration.

So provide these variable names in the format to indicate that a variable name is in use and the IDE will even suggest you the available variables as you type.

In our scenario also, we need to use the variables receiver, message and sender respectively as the variable names. For all these 3 fields, you can either provide constant values or variable names that hold the actual values. Then you need to provide the mobile number to send the SMS, the message to be sent, as well as the sender ID. Then on the configuration panel, select Resource Type as Direct SMS. Then the final step is to use AWS SNS to send the given message as a SMS to the receiver.įor that drag a SNS resource from the resource panel on the left and drop it on the line before the callback function (line 9 as per above code). So here we only have to extract the above information from the event object and assign them to variables for further use as follows. When the conventional API Gateway-Lambda integration is used (as we have done), the request payload received by the API will be injected to the lambda function as the event object. Our next task is to extract the necessary information such as the message to be sent, receiver’s phone number and sender name from the request.

Now the event variable should have been turned into green. Once you are done, click on Inject button to add the trigger. You can use any value you like for the API name, resource path and also for the deployment stage, but make sure that the method is selected as POST. Then on the configuration panel, fill the APIGateway details as follows. Our first step is to define an API Gateway endpoint to accept requests and set it as the trigger for our lambda function.įor that, drag an API Gateway resource from the resource panel on the left and drop it on top of the red coloured event variable of the lambda function.
