Professional Documents
Culture Documents
It allows you to prototype with WhatsApp immediately using a shared phone number,
without waiting for a dedicated number to be approved by WhatsApp.
To get started, select a number from the available sandbox numbers to activate your
sandbox.
Be sure to take note of the phone number you choose in the Sandbox. You will need
this later when we're ready to send some messages. (In the image above the number is
+14155238886).
Basically, you need to send “join <your sandbox keyword>” to your Sandbox number in
WhatsApp to join your Sandbox, and twilio will reply with a confirmation that you’ve
joined.
When this is completed, you should be able to see your number here:
https://www.twilio.com/console/sms/whatsapp/sandbox under Sandbox Participants.
4- Gather your Twilio account credentials. You can find these in the Twilio console:
https://www.twilio.com/console
● Account SID - Used to authenticate REST API requests
● Auth Token - Used to authenticate REST API requests
❏ AWS setup:
1- Open your AWS account and create an IAM role to give permissions to lambda to
write to cloudWatch logs:
2- Create a lambda function as shown below: select python 3.7 for runtime and the role
we created above.
3- Go to AWS API Gateway and create a new API:
4- Select the API you created and create a new resource called “message” as shown
below:
5- Select the resource you created in the step above and create a POST method.
Select the lambda function we created in step 2:
6- Deploy the API:
curl -X POST
https://iqxlrv7fq1.execute-api.us-east-1.amazonaws.com/dev/message (to be
replaced with YOUR URL. Do not forget to add the resource /message at the
end)
1- Open your new relic account, click on Alerts then on Notification channels.
Click on add New notification channel and select webhook:
Give the channel a name like “whatsapp integration” and then put the URL we created
with API Gateway (in step 7 in AWS setup) in base Url field.
Click on “use custom payload” and add “to” attribute the the payload to include the
whatsapp number you would like to notify. This number is the number you have
added in Twilio setup in step 3.
{
"account_id": "$ACCOUNT_ID",
"account_name": "$ACCOUNT_NAME",
"closed_violations_count_critical": "$CLOSED_VIOLATIONS_COUNT_CRITICAL",
"closed_violations_count_warning": "$CLOSED_VIOLATIONS_COUNT_WARNING",
"condition_family_id": "$CONDITION_FAMILY_ID",
"condition_id": "$CONDITION_ID",
"condition_name": "$CONDITION_NAME",
"current_state": "$EVENT_STATE",
"details": "$EVENT_DETAILS",
"duration": "$DURATION",
"event_type": "$EVENT_TYPE",
"incident_acknowledge_url": "$INCIDENT_ACKNOWLEDGE_URL",
"incident_id": "$INCIDENT_ID",
"incident_url": "$INCIDENT_URL",
"open_violations_count_critical": "$OPEN_VIOLATIONS_COUNT_CRITICAL",
"open_violations_count_warning": "$OPEN_VIOLATIONS_COUNT_WARNING",
"owner": "$EVENT_OWNER",
"policy_name": "$POLICY_NAME",
"policy_url": "$POLICY_URL",
"runbook_url": "$RUNBOOK_URL",
"severity": "$SEVERITY",
"targets": "$TARGETS",
"timestamp": "$TIMESTAMP",
"violation_callback_url": "$VIOLATION_CALLBACK_URL",
"violation_chart_url": "$VIOLATION_CHART_URL",
"to" : "+15005550006"
}
{
response: 200,
{"statusCode": 200, "body": "\"Hello from Lambda!\""}
}
3- Open the lambda function we created previously in AWS. Then change the code
entry type to “upload a .zip file”
4- Upload the zip file and save your lambda function (wait until the file is uploaded).
Go to NR webhook and make sure you have put your phone number in the “to” field as
described in the NR setup paragraph, then send a notification test.
You should receive this message from twilio sandbox (second message in the screen
shot):